(CNN) The Department of Justice is fighting a multi-front legal war sporead across the country, defending President Donald Trump's creative efforts to get around Congress and the Constitution and his nonstop policy of undoing Obama-era regulations and protecting his businesses and tax returns.

This week the President has already suffered several big losses and one huge win, and it's only Wednesday.

Emoluments relief; immigration, census and Twitter defeats

The win came from Richmond, Virginia, where a three-judge panel for the 4th US Circuit Court of Appeals dismissed a case brought by attorneys general from Maryland and the District of Columbia about whether foreign visitors to Trump's Washington hotel violate the Emoluments Clause of the Constitution.

Trump was glowing on Twitter about the decision. "I don't make money, but lose a fortune for the honor of serving and doing a great job as your President (including accepting Zero salary!)," he said.

But it came after a string of setbacks in other cases over the past two weeks.

When the Supreme Court agreed with a group of attorneys general and said Trump couldn't put a citizenship question on the 2020 census, he wouldn't take no for an answer.

He made his lawyers, who had already told the courts they needed to move ahead with printing by July 1, reverse themselves and tell a judge they wanted to add the question anyway. Then Trump tried to swap out the Justice Department legal team on the case, until a federal judge in New York said this week that he couldn't just sub in new lawyers.

"Defendants provide no reasons, let alone 'satisfactory reasons,' for the substitution of counsel," wrote District Judge Jesse Furman

The citizenship question is part of Trump's effort to crack down on immigration, as is the border wall he's still fighting to get built -- but that's running into trouble in court, too. When Congress wouldn't give him money for it, he made an end run around lawmakers, declaring a state of emergency to take money from the Pentagon.

judge in California moved that process along , ruling against the administration in separate decisions. One involved attempts by the administration to divert $2.5 billion from the Pentagon budget to build the wall. The other suit, brought by the American Civil Liberties Union on behalf of the Sierra Club and border communities, involved six proposed wall sites and whether the wall would harm their value.

Not all of the cases involve states suing the President. A group of Twitter users won their case when a panel of the 2nd US Circuit Court of Appeals ruled he cannot constitutionally block Twitter users because it violates the First Amendment.

"The Justice Department argued in March that the President wasn't "wielding the power" of the federal government when he blocked certain individuals from his personal Twitter account, @realDonaldTrump, because while the President sends tweets in his official capacity, he blocks users as a personal matter."

Rise of the AGs

But most of these lawsuits have been brought by Democratic states. Even if they lose, they often succeed in delaying and diluting Trump's policies, according to Paul Nolette, a Marquette University political science professor who has created a massive database to track every lawsuit brought against the Trump administration..

"The number of lawsuits against the Trump administration is off the charts compared to how states and AGs have approached previous administrations," said Nolette.

As many lawsuits have been filed by attorneys general against the Trump administration in less than three years than were filed during the entire eight years of the Obama administration, and more than the entire eight years of the George W. Bush administration, Nolette said.

He added that the surge says as much about states as it does about Trump.

"A big part of this story is that AGs have really unlocked their power in the last several years," he said, pointing out that Republican attorneys general used a similar tactic against President Barack Obama, although Democratic attorney generals have supercharged it under Trump. The states joining the most lawsuits against Trump are New York and California. Texas brought the most against Obama.

Trump's win/loss ratio in court

According to Nolette's analysis, state attorneys general have won 51% of their suits against Trump and lost less than 11%. More than a third haven't had any sort of judicial action yet.

Even with a loss, the tactic slows down, frustrates and ultimately changes a proposed policy. Nolette pointed to Trump's early efforts to impose a travel ban on Muslim-majority countries. That ban ultimately was pushed through with his executive action, but the courts forced dramatic alterations.

It is a symptom of partisanship in the country. A bloc of Republican attorneys general bring their lawsuits in, say, the 5th US Circuit Court in Texas. Democrats choose either New York or the 9th US Circuit on the West Coast, which they perceive to be friendlier.

Not all of the suits are brought against Trump or by Democratic states. There's carryover from the Obama administration on the Affordable Care Act, which Republicans have been unable to repeal except to zero out the tax Americans must pay if they fail to obtain health insurance.

Judges in Texas sounded sympathetic to the argument made by Republican states that zeroing a tax makes it not a tax, which invalidates the whole law. Democratic states have stepped in to defend the law. Trump's administration joined the Republican effort after a lower court judge agreed with it. There are huge implications if the law is thrown out, since it is now woven into the fabric of the US health care system and millions get insurance directly as a result of it.

Trump has promised a replacement plan, but it hasn't yet materialized. Even if it does, lawmakers are so split on the issue of health care that passing anything that won't somehow wind up in the courts would be difficult.

Zeroing out the tax was a creative attempt by Republicans to do what they couldn't accomplish directly; repealing the Affordable Care Act. Similarly, Trump's immigration action was a new use of the emergency powers given to the President.

"There are a lot more (and higher visibility) suits because Trump has been so aggressive in pushing, to varying degrees of success, novel and unprecedented approaches to government policies -- both substantively and procedurally," said Stephen Vladeck, a CNN analyst and law professor at the University of Texas.

Without anything meaningful happening in Congress other than judicial appointments in the Senate and multiple oversight investigations in the House, the only avenue left to Trump is executive action -- something he's considering in the census case but that doesn't preclude fresh lawsuits, either.

Which means there will be more of these lawsuits. And that's why Senate Majority Leader Mitch McConnell, whose long-term plan is to put a lot more Republican-appointed judges on the bench, gets along so well with Trump.

Democratic Sen. Tina Smith of Minnesota recently complained in a CNN opinion piece that it feels like the Senate does little other than confirm judges now that the filibuster is gone and the amount of time required to debate their nominations has been shortened.