WASHINGTON — The Supreme Court declared Friday that same-sex couples have a right to marry anywhere in the United States.

Gay and lesbian couples already can marry in 36 states and the District of Columbia. The court’s 5-4 ruling means the remaining 14 states, in the South and Midwest, will have to stop enforcing their bans on same-sex marriage.

The outcome is the culmination of two decades of Supreme Court litigation over marriage, and gay rights generally.

Justice Anthony Kennedy wrote the majority opinion, just as he did in the court’s previous three major gay rights cases dating back to 1996. It came on the anniversary of two of those earlier decisions.

“No union is more profound than marriage,” Kennedy wrote, joined by the court’s four more liberal justices.

The ruling will not take effect immediately because the court gives the losing side roughly three weeks to ask for reconsideration. But some state officials and county clerks might decide there is little risk in issuing marriage licenses to same-sex couples.

U.S. Sen. Dick Durbin and Chicago Mayor Rahm Emanuel are among public officials applauding the U.S. Supreme Court’s decision giving same-sex couples the right to marry anywhere in the nation.

In a statement, Emanuel called Friday’s decision a “victory for America’s true values of treating everyone equally under the law.” Durbin called it “another step in the march toward equal rights.”

Cook County Clerk David Orr said in a statement that the decision was long overdue.

Illinois lawmakers approved gay marriage in 2013, and it was enacted in June of last year. Since then, Orr says more than 7,500 marriage licenses have been issued to same-sex couples. More than a quarter of those were for couples who came from out of state to get married.

“Today’s decision by the Supreme Court is a victory for equal justice under law in America,” former Gov. Pat Quinn said in a statement. “Marriage equality is the law of the land. Loving couples in every state can now receive the rights and protections of marriage.

“As I said when I signed the Illinois marriage equality law on Nov. 20, 2013, ‘Love is patient, love is kind … love never fails.’”

The cases before the court involved laws from Kentucky, Michigan, Ohio and Tennessee that define marriage as the union of a man and a woman. Those states have not allowed same-sex couples to marry within their borders and they also have refused to recognize valid marriages from elsewhere.

Just two years ago, the Supreme Court struck down part of the federal anti-gay marriage law that denied a range of government benefits to legally married same-sex couples.

The decision in United States v. Windsor did not address the validity of state marriage bans, but courts across the country, with few exceptions, said its logic compelled them to invalidate state laws that prohibited gay and lesbian couples from marrying.

Obergefell v. Hodges: same-sex marriage ruling

The number of states allowing same-sex marriage has grown rapidly. As recently as October, just over one-third of the states permitted same-sex marriage.

There are an estimated 390,000 married same-sex couples in the United States, according to UCLA’s Williams Institute, which tracks the demographics of gay and lesbian Americans. Another 70,000 couples living in states that do not currently permit them to wed would get married in the next three years, the institute says. Roughly 1 million same-sex couples, married and unmarried, live together in the United States, the institute says.

The Obama administration backed the right of same-sex couples to marry. The Justice Department’s decision to stop defending the federal anti-marriage law in 2011 was an important moment for gay rights and President Barack Obama declared his support for same-sex marriage in 2012.

A look at the cases that remain:

  • Lethal injection: Death-row inmates in Oklahoma are objecting to the use of the sedative midazolam in lethal-injection executions after the drug was implicated in several botched executions. Their argument is that the drug does not reliably induce a coma-like sleep that would prevent them from experiencing the searing pain of the paralytic and heart-stopping drugs that follow sedation.
  • Independent redistricting commissions: Roughly a dozen states have adopted independent commissions to reduce partisan politics in drawing congressional districts. The case from Arizona involves a challenge from Republican state lawmakers who complain that they can’t be completely cut out of the process without violating the Constitution.
  • Mercury emissions: Industry groups and Republican-led states assert that environmental regulators overstepped their bounds by coming up with expensive limits on the emissions of mercury and other toxic pollutants from power plants without taking account of the cost of regulation at the start of the process. The first-ever limits on mercury emissions, more than a decade in the making, began to take effect in April.
  • Repeat offenders: The court is considering whether a catchall provision of the Armed Career Criminal Act, which gives longer prison terms to people with at least three prior violent felony convictions, is so vague that it sweeps in relatively minor crimes.