The new Democratic majority in the House spells big trouble for President Trump, who will now be subject to substantial congressional oversight. But it also could be the first step in unmaking his longer legacy, particularly when it comes to the Supreme Court.

In the past few months, with an eye toward their eventual return to power in Washington, some Democrats have floated the possibility of impeaching Justice Brett Kavanaugh or increasing the size of the Supreme Court. Republicans, in turn, have denounced these calls as illegitimate attacks on judicial independence.

But they are wrong. Tinkering with the size of the court is an extreme measure, to be sure, but such proposals aren’t necessarily an assault on the role of the courts in American government. Rather they are sometimes a response to judges who try to impose their partisan will on a country that has moved in a different direction. Indeed, if the justices want to safeguard their independence, the court must give the elected branches the room to respond to the popular will.

Oversight of the judiciary has been part of presidential and congressional power since the nation’s early years. The election of 1800 produced the first partisan turnover of government control in American history. Thomas Jefferson unseated President John Adams, and Jefferson’s supporters captured both houses of Congress from Adams’s Federalist Party. During the lame-duck session following the election, the Federalists dramatically increased the size of the federal judiciary, and Adams began rushing through the nominations of “midnight judges,” all of whom happened to be loyal Federalists. President-elect Jefferson complained that “the Federalists have retired into the judiciary as a stronghold . . . and from that battery all the works of republicanism are to be beaten down and erased.”

Once the Jeffersonians took control, they impeached Supreme Court Justice Samuel Chase. This maneuver might seem like pure political payback, but the Jeffersonians had good cause for concern. In addition to the Federalists’ blatant court-packing, Chase had launched into partisan rants from the bench, denouncing Jefferson’s supporters in open court during the campaign. The Senate narrowly acquitted Chase, but the episode set a pattern that would be repeated.

A similar episode played out during the Civil War. When the Southern states seceded, one Democratic justice resigned to join the Confederacy, but others remained on the court, determined to resist the Union cause from within. Chief Justice Roger Taney, author of the infamous Dred Scott decision, repeatedly tried to strike down military orders issued by President Abraham Lincoln. Taney also tried to hold the military draft law unconstitutional.

In the face of these efforts, abolitionist Sen. John Hale (R-N.H.) called on the Senate Judiciary Committee to explore the possibility of abolishing the court to get rid of Taney and his obstructionist colleagues. The Congress would then create a new court fully staffed by Lincoln. Hale felt like “the Supreme Court of the United States, as at present established . . . is bankrupt in everything that was intended by the creation of such a tribunal.” Instead of carefully expounding the law, the justices were more often declaring “what was agreeable to” the party that had put them on the bench. That party was no longer in power, and Hale saw no need “to hold up and maintain what they have built up, as the citadel in our midst.”

In other words, Hale had the same complaints about the Democratic court that Jefferson had 60 years earlier about the Federalist court.

In the late 19th century, a related scenario arose. While the Democratic Party routinely captured the House of Representatives, and once won the popular vote for the presidency, the unique structures of American governance gave Republicans a virtual lock on the Senate and the electoral college, and as a result, on the Supreme Court. This meant a court out of touch with the popular will — something Republicans relied on. Twice when they lost the House, they used a lame-duck session to expand the power and jurisdiction of the federal courts, making it easier to check popular legislation.

Some of the Republican-appointed judges did little to hide their politics. In an 1893 address, Justice David Brewer related how the “independence and vigor of the judiciary" would be “the salvation of the nation," ensuring "the permanence of government of and by the people.” Which wouldn’t be notable, except that Brewer felt this way because the judiciary was best positioned to protect “the unvarying law, that the wealth of the community will be in the hands of a few . . . while the many subsist upon the proceeds of their daily toil.”

As with Chase and Taney before him, Brewer thought of himself as defending the Constitution and the rule of law, but he served on the Lochner court that notoriously overstepped its legitimate bounds. The court’s nickname came from the 1905 decision in Lochner v. New York that overturned a law seeking to protect the health of bakery workers by limiting the number of hours they worked. The court struck down the law for violating a “liberty of contract” that allowed workers and employers to enter into any kind of employment relationship that they chose.

Lochner illustrated the late 19th- and early 20th-century court’s habit of striking down restrictions on the ability of employers to extract maximum value from their employees, including minimum wage laws and regulations of child labor. During one stretch from 1887 to 1905, the court heard 16 cases involving railroads, and ruled for the railroad companies in 15 of them.

These decisions sparked national outrage, including populist Democratic calls to abolish the power of judicial review, repeal key provisions of the Constitution or change the size of the court.

Decades later in 1937, when President Franklin Roosevelt proposed his infamous court-packing plan, he thought of it as a moderate proposal because it would not take away any of the court’s powers. Roosevelt was elected along with large Democratic majorities in both houses in the midst of the Great Depression, with banks failing left and right and unemployment at 25 percent. Yet the court routinely struck down measures aimed at combating the Depression. The conservative justices were enforcing a constitutional vision of limited government that had been rebuked by the American people, and Roosevelt believed the only way around this obstruction was increasing the size of the court, so he could appoint new justices who would read the Constitution in a new light.

In each of these cases, those calling for changes to the court faced public denunciations for interfering with the independence of the judiciary. Judicial independence is a fundamentally important constitutional value, but to many Americans, these complaints rang hollow.

It didn’t make sense then — and it doesn’t make sense now — to denounce elected leaders pushed into exploring extreme solutions by a judiciary hell-bent on imposing its partisan will. In each of these cases, the damage to judicial independence came not so much from populist politicians calling for curbs on judicial power but from partisan judges who abused that power.

Now that Democrats have recaptured the House, all eyes turn to 2020. If they recapture the White House and Senate, Democrats will likely explore innovative institutional solutions to the problem of partisan courts. If our sitting Republican judges act like judges, these innovative proposals will fall flat. But if the judges heed Kavanaugh’s angry call for partisan retribution — if they use their undemocratic hold on judicial power to promote the interests of the Republican Party — then some Democratic proposals for the courts are likely to pass. And the judges will have no one but themselves to blame.