The Supreme Court has a penchant for drama. Much like many past terms, the Court entered its final week of this term with several high-profile decisions left undecided. Past terms tackled issues such as Obamacare and same-sex marriage. This term concluded with debates over partisan gerrymandering and whether to include a citizenship question on the 2020 census.

In both of those cases, Chief Justice John Roberts wrote the majority decision. His decision that partisan-gerrymandered districts presented inherently political questions beyond the reach of federal courts enraged many on the left. His decision to block the census question temporarily—potentially preventing its appearance on the 2020 census—frustrated many of the president’s allies.

Following these decisions, the Chief Justice has received significant criticism from every political corner. This is perhaps indicative. If the Chief Justice is receiving criticism from all sides, perhaps he is doing something right. Concluding so warrants a closer look at both recent opinions.

The Court’s gerrymandering decision consolidated two cases contesting gerrymandered congressional maps in North Carolina and Maryland. Evidence supported the argument that the North Carolina General Assembly designed the state’s congressional map to benefit Republican candidates. Other evidence showed that Maryland lawmakers did the same for Democrats. In both instances, lower federal courts ruled that the maps were unconstitutional. On appeal, the Court found that although “[e]xcessive partisanship in districting leads to results that reasonably seem unjust,” the problem nevertheless cannot be solved by federal courts absent “an unprecedented expansion of judicial power.”

Passionate criticism followed. One liberal commentator called it “a catastrophic loss for democracy.” The New York Times Editorial Board argued that the decision “open[ed] the door for politicians of both parties essentially to pick their voters, disfavoring parties that are not in power.”

There are few supporters of blatant gerrymandering—especially at the Supreme Court. The Chief Justice himself observed that the challenged maps were “blatant examples of partisanship,” and nothing in his opinion endorsed the practice. Yet although the practice is overwhelmingly unfavorable, Roberts nevertheless found the debate nonjusticiable in federal courts.

His reasons are persuasive. Applying the political question doctrine (a nearly 60-year-old precedent), Roberts explains that courts have no “manageable standards” for resolving partisan gerrymandering claims. After all, what is a fair district (opposed to an overly unfair district)? Experts disagree. What judicial tests can courts use to determine gerrymandered districts? Judges are still unsure. Even if the answers were marginally clear, gerrymandering disputes would likely never end. As Roberts observed, judicial intervention “would recur over and over again around the country with each new round of districting.”

Beyond these pitfalls, Roberts also addresses the obvious: Critics desperate for democratic reform are seeking it in the least democratic branch. Roberts takes time to note bills Congress has previously introduced to limit partisan gerrymandering. He also cites state court rulings, amendments to state constitutions and local independent commissions that curbed partisan district-making. These paths “for reform,” Roberts emphasizes, “remain[] open.”

Unlike the partisan gerrymandering cases, the 2020 census case is not necessarily over. Before the Court’s ruling, the Trump administration planned to include a citizenship question on the 2020 Census. The Commerce Department’s purported reason for including the question was issued on behalf of the Department of Justice (DOJ), who claimed the data was needed to enforce the Voting Rights Act. Writing for the majority, the Chief Justice was not convinced, asserting that “the evidence tells a story that does not match the explanation the Secretary gave for his decision.” The Court therefore remanded the case back to the Commerce Department to try again.

The implication of the Court’s remand is uncertain, but because the government claims it soon needs to print the 2020 census questionnaire, it may run out of time to relitigate the case—effectively barring the question from appearing on the census. Some administration allies—and the president himself—were irate over the weekend. One conservative leader (and spouse of a White House aide) advocated for Roberts’ impeachment. President Trump himself called the decision “totally ridiculous” and openly suggested delaying the census count.

The majority decision was based on the Administrative Procedure Act. In short, and as Roberts explains, the “Administrative Procedure Act calls for an explanation for agency action.” And although courts are generally deferential to agency decisions, they are “not required to exhibit a naiveté from which ordinary citizens are free.” In this case, there was sufficient evidence to suggest that the Commerce Department’s decision to include a citizenship question was pretextual, and not based on the DOJ’s subsequent request for data.

The Chief Justice’s opinions in both the gerrymandering and census cases merit close review. Both opinions are persuasive, logical and lead to results that inflame many partisans—a welcome outcome in polarized times.