A president who wields power like few before him has received a stunning — and disconcerting — affirmation from the U.S. Supreme Court of just how expansive his reach is, at least as regards immigration.

It is a ruling that should put voters on high alert as they approach midterm elections that carry unusually high stakes if this nation is to preserve the system of checks and balances that is the foundation of American democracy.

In its 5-4 decision upholding an executive ban mainly aimed at certain Muslim-majority countries, the court left little doubt that it considers the president to be the supreme authority on matters regarding who enters or exits this nation, how and under what conditions. Its unambiguous language, crafted by Chief Justice John Roberts, forcefully declared that President Donald Trump “lawfully exercised the broad discretion granted to him … to suspend the entry of aliens into the United States.” That law, the justices said, “exudes deference to the President in every clause, and vests him with ‘ample power’ to restrict entry.”

The decision gives a solid green light to Trump for his modified travel ban that restricts entry from the nations of Somalia, Iran, Syria, Libya, Yemen, North Korea and, to a lesser extent, Venezuela. The court went to some lengths to state that it was not ruling on the policy itself. “We express no views on the soundness of the policy,” the majority opinion stated.

Justices chose to ignore the fiery anti-Muslim sentiments repeatedly expressed by Trump. Casting aside intent and motive, the ruling instead focused on the language of the ban itself, whose neutral wording allowed the majority to neatly sidestep the religious animus so evident in Trump’s statements.

The Supreme Court is the highest legal authority in this land, but it has made mistakes before and will again. There are decisions that continue to live in infamy. Among the most shameful, Korematsu vs. United States, which affirmed the president’s ability to remove Japanese-American civilians from their homes and imprison them in internment camps during World War II. Stung by the comparison to Korematsu in a scathing dissent written by Justice Sonia Sotomayor, the Roberts ruling finally, after 74 years, fully repudiated that decision. One can only wonder whether Hawaii vs. Trump will someday meet the same ignominious fate.

The nation need not wait as long this time. Voters alarmed by the often harsh and retaliatory reach of this executive branch should be mindful that they have the ability to effect change in November. If the nation is to have a high court that adheres strictly to the text of the law, ignoring animus and giving the greatest possible deference to the executive, a new Congress could — and should — reassert its authority if there is to be any check at all on the presidency.

The news Wednesday of Justice Anthony Kennedy’s impending retirement — in time for Trump to get a nominee through the GOP-dominated Senate — only underscores the urgency of the moment. Although Kennedy sided with the majority on the travel ban and several other major recent decisions, he has in the past been an important swing vote on preserving abortion rights, legalizing same-sex marriage, limiting the death penalty and other issues.

With Kennedy’s departure, Trump has the opportunity to install a more reliable conservative and build a more solid majority on the court for years to come. A democratic form of government, one with robust checks and balances on runaway power, is not a given — not even in the United States of America. It depends on an engaged electorate.