“Mr. Cohen, tell the Court I love my wife and it is just unfair that I can’t live with her in Virginia.” That was the message that Bernard S. Cohen delivered in 1967 to the justices of the U.S. Supreme Court on behalf of his client, Richard Loving, a White man who had been roused from his bed in the middle of the night and arrested along with his wife for violating a state ban on interracial marriage.

Richard Loving and Mildred Loving, who was of African American and American Indian heritage, became the protagonists in a legal battle that ended with a ruling striking down anti-miscegenation laws — “the last de jure vestige of racism” in the United States, as Mr. Cohen later described them. Less than seven years out of law school, he was one of two lawyers to argue their case before the Supreme Court, shaping an argument that would reverberate for decades in that chamber and beyond.

Mr. Cohen, who later became a prominent liberal member of the Virginia House of Delegates, died Oct. 12 at an assisted-living facility in Fredericksburg, Va. He was 86. The cause was Parkinson’s disease, according to his family.

Mr. Cohen joking described himself as “an old man of 29” when he first met the Lovings, a couple from Caroline County, roughly midway between Fredericksburg and Richmond, where both had grown up. Richard, a bricklayer, was 24 when they married in 1958. Mildred, six years his junior, was pregnant with the first of their three children.

Prohibited by the Racial Integrity Act of 1924 from marrying in Virginia, the couple were wed in D.C. on June 2, 1958. Weeks later, after their return to Virginia, local authorities forcibly entered their home at 2 a.m., shining flashlights in their eyes.

“They asked Richard who was that woman he was sleeping with, and I said, ‘I’m his wife,’ ” Mildred Loving later recalled, according to an account in Washingtonian magazine.

“Not here you’re not,” the sheriff replied.

The Lovings were arrested, pleaded guilty to violating the Racial Integrity Act and avoided a one-year jail term by consenting to leave Virginia and not reenter the state for 25 years. They settled in the District but, far from their families and friends, were unhappy there. When one of their sons was hit by a car, Mildred Loving decided that they had to leave the city.

“He was sitting up in the street crying,” she said. “And I think that was the straw that broke the camel’s back. I had to get out of there.”

The couple wrote to Attorney General Robert F. Kennedy, asking if he might assist them. He referred them to the American Civil Liberties Union, which in turn connected them with Mr. Cohen, one of the organization’s volunteer lawyers. He practiced in Alexandria, Va., but met the couple in Washington, to avoid making them enter Virginia.

“I knew it was going to be a landmark case,” Mr. Cohen told the Associated Press in 1992. “I knew it was going to the Supreme Court. And I definitely thought there was something serendipitous about the fact that the case would be called Loving vs. the Commonwealth of Virginia.”

He said that the Lovings, who were described in news accounts as deeply private people, were shocked by his assessment of the importance of their case.

Because they had pleaded guilty, Mr. Cohen had to overcome procedural challenges to return the case to court in Virginia, where a judge ruled that “Almighty God created the races white, black, yellow, malay and red, and he placed them on separate continents. And but for the interference with his arrangement there would be no cause for such marriages. The fact that he separated the races shows that he did not intend for the races to mix.”

Working with a co-counsel, Philip J. Hirschkop, Mr. Cohen filed a federal class-action suit, which on April 10, 1967, reached the Supreme Court. Mr. Cohen received some “nasty phone calls at home” and “experienced some freezing-out by some of my colleagues who wanted to keep their distance,” he told The Washington Post, in the course of the case.

Their argument hinged on two fundamental constitutional concepts, the guarantees of equal protection and due process.

But “no matter how we articulate this, no matter which theory of the Due Process Clause,” Mr. Cohen argued before the justices, “no one can articulate it better than Richard Loving when he said to me, ‘Mr. Cohen, tell the Court I love my wife and it is just unfair that I can’t live with her in Virginia.’ ”

On June 12, 1967, the Court unanimously ruled that the state could no longer prohibit mixed-race marriages, with Chief Justice Earl Warren condemning laws such as Virginia’s anti-miscegenation statute as “odious to a free people.”

Mr. Cohen said that when the lawyers called the Lovings to inform them of the decision, the couple asked, “Well, what do we do now?”

“We said, you just go on living,” he told NPR in 2007. “Nobody’s going to bother you anymore over this.”

The son of Jewish immigrants, Bernard Sol Cohen was born in Brooklyn on Jan. 17, 1934. His father, a furrier, was from Romania, and his mother was from Latvia. Mr. Cohen’s older brother was killed while serving in the Army during World War II.

Mr. Cohen was a 1956 economics graduate of the City College of New York and worked at the Labor Department while pursuing a law degree at Georgetown University, where he graduated in 1960.

He entered private practice in Alexandria, cultivating specialties in environmental and employment law until his retirement in 2006. He served in the House of Delegates from 1980 until 1996, representing a section of Alexandria.

Described by The Post as “more unabashedly liberal than the typical Virginia Democrat,” Mr. Cohen was best known in the state Capitol for his successful efforts to impose restrictions on indoor smoking — over powerful pressure from the tobacco lobby — and for his work on measures strengthening the rights of terminally ill patients to decline certain life-prolonging treatments.

Survivors include his wife of 61 years, the former Rae Rose, of Spotsylvania, Va.; two children, Bennett Cohen of Centreville, Va., and Karen Cohen of Haymarket, Va.; and three grandchildren.

Mr. Cohen represented Mildred Loving a second time when she filed a lawsuit stemming from her husband’s death in 1975 in an automobile accident involving a drunk driver, and he was present at her home when she died in 2008.

The Lovings and their ordeal were dramatized in films including the 2016 movie “Loving” by director Jeff Nichols, in which actor Nick Kroll portrayed Mr. Cohen. The case had been revived in the public consciousness a year earlier, when Loving v. Virginia was cited as precedent in the 5-to-4 Supreme Court decision in Obergefell v. Hodges legalizing same-sex marriage.

“The decision in Loving brought enough to encompass the principle involved in the same-sex marriage case,” Mr. Cohen told the Richmond Times Dispatch. “Because the constitutional principle involved is the same, the right to marry is a constitutionally protected right of liberty. I think it’s that easy.”