Legal scholars and progressives have long expressed doubt about the utility of courts in advancing social justice. They argue that courts are inherently conservative, that victories often prompt costly backlashes, and that focusing on courts diverts attention from the more important work that needs to be done in the political arena.

The first year of the Trump administration suggests that this skepticism is overstated. Much to the president’s dismay, those he calls “so-called judges” have repeatedly ruled against the Trump administration. Judges appointed by Republicans and Democrats alike have enforced constitutional guarantees against a president who has shown little regard for the Constitution.

In this respect, the courts have performed just as Alexander Hamilton hoped they would. In the Federalist Papers, Hamilton argued that a judiciary with life tenure and the power to declare the political branches’ actions unconstitutional was essential, so that judges could serve as “the bulwarks of a limited Constitution.” Rarely has that role been more essential.

Consider the results.

Muslim ban

Multiple courts have invalidated all three versions of President Trump’s travel ban, enacted to make good on his campaign promise to prohibit Muslims from entering the country. The first court ruling against the ban came in an ACLU case filed just one day after Trump introduced it. Trump abandoned the first two versions of the ban after courts repeatedly ruled them illegal. The third and most recent version, also declared invalid by the courts, is now headed to the Supreme Court. But already, Trump has been forced to revise and limit his initial action.

Transgender military ban

Two federal courts have preliminarily struck down President Trump’s prohibition on transgender people serving in the military, a policy he announced on Twitter without even consulting the military, which had previously determined that there was no reason to exclude transgender servicemembers. In December, two federal appeals courts unanimously rejected the administration’s effort to lift those injunctions, pending appeal. Cutting its losses, the administration chose not to seek Supreme Court review.

Abortion access

Federal courts in the District of Columbia have twice ordered the Trump administration to stop obstructing access to abortion for teenagers in federal immigration custody. The head of the Office of Refugee Resettlement, Scott Lloyd, has no experience with immigration but is an ardent opponent of abortion. He has refused to allow four undocumented minors in federal custody to obtain abortions, even though they have a constitutionally protected right to do so. After federal courts repeatedly ruled for the women, the Trump administration backed down in the two most recent instances, releasing the women from its custody when the ACLU filed suit.

DACA

In December, a federal court in San Francisco temporarily ordered the administration to allow “Dreamers,” the undocumented immigrants whose parents brought them here as children, to renew their applications for protection from deportation, under the program known as Deferred Action for Childhood Arrivals, or DACA. On Jan. 13, the administration announced that it would follow the order and allow DACA recipients to renew their status pending a final resolution of the lawsuit.

“Enemy combatant” detention

In December, a federal court ordered the Trump administration to afford the ACLU access to an unnamed U.S. citizen the military has been detaining in an undisclosed location in Iraq without charges and without access to a lawyer for four months. The government chose not to seek an immediate appeal, and allowed the ACLU to consult with the detainee, who confirmed that he wanted legal help to challenge his detention. In Hamdi v. Rumsfeld, the Supreme Court sharply rejected President George W. Bush’s assertion that he had unchecked power to hold U.S. citizens as “enemy combatants,” yet Trump is at it again.

Contraception insurance coverage

A federal court in Pennsylvania has preliminarily enjoined President Trump’s rollback of an Obamacare requirement that employers cover the cost of contraception in the insurance plans they provide to their employees.

Sanctuary cities

A federal court in California barred the Trump administration from denying federal funds to cities and counties that adopt “sanctuary” policies and decline to enforce federal immigration laws. (Under the Tenth Amendment, states cannot be compelled to enforce federal law, but the Trump administration threatened to make big funding cuts to coerce states into doing so.)

Voter suppression

On Jan. 3, President Trump disbanded his controversial “voter integrity” commission, designed to establish a basis for supporting Republican voter suppression efforts. Trump’s order ending the commission explained that “rather than engage in endless legal battles at taxpayer expense, today I signed an executive order to dissolve the Commission.” The commission had been sued not only by numerous civil rights groups, but even by one of its own members.

Not every constitutional challenge has been successful. A federal judge in New York recently dismissed a case charging Trump with violating the Constitution’s Emoluments Clause, which forbids the president from accepting any “emolument,” or payment, from a foreign or domestic state official. The court did not rule on the merits, but merely concluded that the plaintiffs did not have sufficiently concrete injuries to raise the claim. (Two other Emoluments Clause lawsuits are pending, brought by members of Congress and the attorneys general of Maryland and the District of Columbia.) But other than this decision, the Trump administration has been singularly unsuccessful defending its actions in court.

In some sense, the long line of victories is a sign of how careless Trump has been when it comes to constitutional constraint. Trump’s utter disregard for convention, including in constitutional matters, does not play well with courts, whose job is to maintain those very conventions. In addition, there can be little doubt that the overwhelming public condemnation of many of these initiatives, by experts and ordinary citizens alike, and by Republicans as well as Democrats, has played an important part in buttressing the judicial push-back. We should never underestimate the power of dissent and criticism as a constraint on government abuse.

The battle is by no means over. Most of these cases are ongoing. The Supreme Court has yet to rule on the merits of any of them. It will almost certainly take up the challenge to the latest version of the travel ban later this year, and that will be Trump’s first test in the Supreme Court. (The Court has stayed the lower courts’ injunctions pending its review).

It remains to be seen whether the Supreme Court will be as forceful a “bulwark of a limited Constitution” as the lower courts have been. But one thing is clear: thus far, the federal courts have been willing to do just what Hamilton hoped they would: Stand up to the president in defense of liberty.