The dispute centers on a protest in September 2015 in front of Trump Tower in Manhattan, during Mr. Trump’s first presidential campaign. Five plaintiffs in the lawsuit were protesting in front of the building. Two were dressed in mimic Ku Klux Klan robes. Others carried large campaign-style signs saying, “Make America Racist Again.”

In an ensuing confrontation, some parts of which were captured in videos, Mr. Trump’s private security detail inaccurately told the protesters that the sidewalk in front of Trump Tower was private property and tried to force them to move away from it.

Mr. Trump’s security director at the time, Keith Schiller, who later had a stint in the White House as an aide to Mr. Trump, ripped away two of the large protest signs and tried to carry them into the building. When one of the protesters, Efrain Galicia, pursued him and grabbed one of the signs, Mr. Schiller struck him in the head, video shows.

Justice Gonzalez noted that the Supreme Court ruled in 1997 that presidents did not have temporary immunity for acts that were done before taking office and were not related to their official duties. In that matter, a federal civil lawsuit by Paula Jones against President Bill Clinton, Mr. Clinton ultimately submitted to a deposition, but the case never went to trial.

Friday’s ruling also pointed to one from a New York appeals court in March that rejected a claim by Mr. Trump’s legal team that, as president, he was immune from state lawsuits under the Constitution. That ruling has permitted a defamation suit — from a former contestant on “The Apprentice” whom Mr. Trump called a liar after she accused him of groping her — to proceed.