Almost 50 years ago, the U.S. Supreme Court transformed the country’s criminal justice system in Gideon v. Wainwright. It guaranteed the right to effective counsel for indigent defendants. On Wednesday, a 5-4 majority of the high court followed the compelling logic of the earlier decision, ruling in another landmark decision that criminal defendants have a constitutional right to competent attorneys during plea negotiations.

Justice Anthony Kennedy, writing for the majority, reminded that “criminal justice today is for the most part a system of pleas, not a system of trials.” The numbers reveal how much that is the case, 97 percent of convictions in federal courts resulting from plea bargains, and 94 percent in state courts. Trials are the exception. Thus, Kennedy correctly concluded that the right to adequate counsel must take into account the reality, the heavy role of plea bargaining in securing convictions and determining sentences in the system.

Consider the two cases the court weighed. One involved a man charged with driving without a license. His attorney failed to tell him about a plea deal from prosecutors, a guilty plea in exchange for 90 days in jail. Instead, the defendant pleaded guilty without a deal, the judge handing down a sentence of three years.

In the other case, a man shot a woman four times below the waist. His attorney advised him that he could not be convicted of assault with intent to murder. So he rejected a plea offer of four years to seven years in prison. At trial, he was convicted and received a sentence of 15 years to 30 years.

In blistering dissent, Justice Antonin Scalia argued that the defendant received all the Constitution guarantees, “the gold standard of American justice — a full dress jury trial before 12 men and women tried and true.” More, he warned the majority has opened “a whole new boutique of constitutional jurisprudence” — “plea-bargaining law.”

Clearly, the ruling brings complications. The majority has set in motion much greater bench scrutiny of what has been largely informal deal-making among prosecutors, defense attorneys and defendants. In his ruling, Justice Kennedy explored potential ways for defendants to show incompetent counsel in plea bargains, and possible remedies, including requiring plea bargains to be in writings or made in open court. The decision will spawn additional litigation.

In that way, Justice Scalia is right. He further lampooned the idea of pursuing the what-might-have-beens as “a process of retrospective crystal-ball gazing posing as legal analysis.” What he neglects is the huge and practical presence of plea bargaining. If the right to competent counsel means anything, it must hold in what is “almost always the critical point for the defendant,” as the majority aptly put it. The fallout likely will be messy, the knotty consequences requiring a sorting through. Yet this is what the criminal justice system is, and what the Constitution requires.