Payback and projection have long been two of President Trump’s touchstones. He settles scores in return for every perceived slight and accuses his targets of what he has done himself. In his second term, that approach has bled into the law, with perilous consequences.

More than most other areas of presidential authority, the Justice Department gives Mr. Trump a way to settle scores — and to help friends. Of course, no one can be convicted without a guilty verdict, but simply by launching an investigation, the federal government can impose ruinous reputational and financial costs.

At the same time, the Trump administration has essentially unlimited discretion to look away from criminality by allies: to halt ongoing D.O.J. investigations, end existing prosecutions and even overturn settled cases. And the Constitution imposes no limit on the president’s power to pardon anyone at any time.

For decades, at least since the aftermath of Watergate, the custom at the Justice Department has been to establish a measure of independence from the political interests of the president. This tradition was especially strong among lower-level federal prosecutors and law enforcement agents, whose careers have been allowed to continue seamlessly from one administration to the next. From Day 1, President Trump and his allies shattered this unwritten but real understanding.

On Jan. 20, the president issued an executive order purporting to address the “unprecedented, third-world weaponization of prosecutorial power” during the administration of President Joe Biden. Mr. Trump directed the attorney general, Pam Bondi, who had yet to be confirmed, to correct her department’s actions against “perceived political opponents,” especially several Jan. 6 rioters at the Capitol, whom the president pardoned the same day.

Weaponization can work two ways: by punishing adversaries or rewarding supporters. Notwithstanding the executive order, the Trump administration has been doing both.

Ms. Bondi’s Justice Department moved quickly to purge the lawyers and some of the F.B.I. agents who led the prosecutions of the Jan. 6 defendants. These career government employees were punished not because they had engaged in misconduct or because their prosecutions lacked merit — their cases passed muster with federal judges — but for the simple reason that they had offended the president, which was, it turned out, a firing offense.

The main instrument for Mr. Trump’s revenge has been Ed Martin, whom Mr. Trump initially chose as the interim U.S. attorney for the District of Columbia, the nation’s biggest office of federal prosecutors, which Mr. Martin called “President Trump’s lawyers.” (In fact, government lawyers don’t represent the president as an individual but rather the Constitution and laws of the United States.) Not only has Mr. Martin fired or demoted prosecutors who brought Jan. 6 cases — including some in which Mr. Martin himself, then in private practice, represented the defendants — but he’s also investigating, on dubious grounds, other Biden-era initiatives.

Denise Cheung, a veteran prosecutor in the office, resigned rather than follow instructions from Mr. Martin to try to rescind $20 billion in grants awarded by the Biden administration for environmental projects. Mr. Martin has also threatened to prosecute the Democratic legislators Chuck Schumer and Robert Garcia for speeches that allegedly threatened Mr. Trump’s allies. In addition, Mr. Martin informed Georgetown University Law Center that his office would no longer hire students from that distinguished institution, or any law school or university “that continues to teach and utilize D.E.I.” — diversity, equity and inclusion. (As the dean of Georgetown’s law school aptly replied, Mr. Martin’s threat is an “attack on the university’s mission as a Jesuit and Catholic institution,” and likely unconstitutional.) In spite of these affronts to the rule of law, or more likely because of his views, Mr. Trump has nominated Mr. Martin for a full term as U.S. attorney.

In a broader step against perceived enemies, Mr. Trump began an unprecedented offensive against law firms that have represented clients whom the president despises. So far the president’s targets have included Covington & Burling, a major Washington firm which has done pro bono legal work for Jack Smith, the special counsel who investigated and prosecuted Mr. Trump, after the president’s congressional allies began examining Mr. Smith’s conduct, and Perkins Coie, another firm with a big Washington presence, which represented Hillary Clinton and other prominent Democrats.

These lawyers did nothing wrong; indeed, representing clients whose interests conflict with those in power ranks among the most honorable traditions of the bar. In response, though, the president ordered the federal government to “terminate” any engagement with either firm, revoked their lawyers’ security clearances and even directed that Perkins personnel be denied access to federal buildings.

The president’s actions are existential threats to the firms — which is their point. His goal is to make both firms so toxic that their clients will flee, which would represent catastrophic blows. The larger message is clear: Mr. Trump is keeping track of anyone who has offended or opposed him, and he will use the power of the presidency to extract maximum consequences.

But the president understands the value of the carrot as well as the stick. The presidency, and especially Mr. Trump’s command of the Justice Department, is well situated for Mr. Trump to reward his supporters. This is most obvious in the case of Mayor Eric Adams of New York. After being indicted on charges of bribery and other crimes in the last months of the Biden administration, Mr. Adams began a charm offensive directed at the new president, visiting Mr. Trump in Florida and attending his inauguration.

The mayor’s ministrations paid off, because Mr. Trump’s Justice Department moved to dismiss the case against Mr. Adams. In doing so, the government did not cite any defect in the evidence against the mayor or any misconduct by the prosecutors in Manhattan, but simply said the case “unduly restricted Mayor Adams’s ability to devote full attention and resources to the illegal immigration and violent crime that escalated under the policies of the prior administration.” (Several prosecutors in the Adams case, including the interim U.S. attorney in Manhattan, resigned in protest.)

Moreover, the fact that the Justice Department asked the case be dismissed “without prejudice” — meaning that the prosecution could be reinstituted if Mr. Adams displeases the administration in Washington — suggests that the strategy is meant to keep Mr. Adams in line. (The judge has not yet ruled on the government’s motion to dismiss the case.)

The Justice Department seems to be scouring the country to find ways to reward its supporters. Last year, Tina Peters, a former county clerk in Colorado, was convicted on state criminal charges of tampering with voting machines in a failed effort to prove that they had been rigged against Mr. Trump in the 2020 election. The Justice Department rarely inserts itself into state prosecutions, but last week Yaakov M. Roth, the acting assistant attorney general for the civil division, filed a brief joining Ms. Peters’s federal court challenge to her state conviction. In his statement to the court, Mr. Roth said he was acting pursuant to President Trump’s executive order on “weaponization” of the government under President Biden.

In an even more direct application of presidential power to reward allies, Mr. Trump is using the pardon power in unprecedented ways. Of course, it’s well known that the president began his second term by pardoning nearly all of the 1,600 or so rioters who had been charged with crimes at the Capitol on Jan. 6, 2021. But he has kept up a steady pace of pardons, all of them aligned with his political agenda.

Mr. Trump has pardoned 23 anti-abortion protesters who invaded and blockaded clinics; Ross Ulbricht, a hero of the crypto movement who was serving a life sentence for running an underground marketplace used by drug dealers; and Rod Blagojevich, who became a Trump supporter after he was convicted of corruption-related crimes as governor of Illinois. The president also plans a posthumous pardon for Pete Rose, the disgraced baseball star who remains a hero in much of red-state America.

Unlike recent presidents who saved up controversial pardons for the end of their terms and granted very few at the beginning, Mr. Trump’s early pardon offensive suggests that he plans to use this power throughout his second term. In this way, the president can guarantee himself a steady stream of supplicants eager to be forgiven for crimes they committed when other men were in the Oval Office.

There’s an important difference between the president’s law enforcement payback agenda and other controversial initiatives of his second term, including the government efficiency efforts led by Elon Musk. Mr. Trump’s imposition of spending cuts has been vigorously challenged in the courts, with some success, even in the Supreme Court. The court may thwart Trump’s plans.

But there are few checks and balances on a president’s authority to enforce, or decline to enforce, the law. And there are no limits at all on whom Mr. Trump may pardon. The courts and Congress have little, if any, role in these matters. Only the norms of history and the customs of decency constrain a president — or, as in this case, they don’t.