NEW YORK — A New York judge has rejected President Donald Trump’s bid to temporarily halt proceedings in a lawsuit filed against him by writer E. Jean Carroll, who has accused him of rape, a ruling that allows the case to move forward in the months before the presidential election.

The decision was a victory for Carroll, who sued Trump in November for defamation after he called her a liar and said he had never met her. She published a memoir last summer that accused Trump of attacking her in a department store dressing room in Manhattan in the 1990s.

Lawyers for Trump had sought to put the lawsuit on hold while an appeals court is deciding whether to dismiss a similar lawsuit filed against Trump by Summer Zervos, a former contestant on “The Apprentice” who has accused him of sexually assaulting her.

In their bid for a delay, the lawyers also said the Constitution gave a sitting president immunity against lawsuits in state court.

On Thursday, Justice Verna Saunders in New York rejected their arguments, pointing to a recent U.S. Supreme Court ruling that concluded Trump could not block a subpoena for his tax returns by the Manhattan District Attorney’s Office.

The Supreme Court ruling determined the president did not possess absolute immunity against state criminal subpoenas.

Although that ruling pertained to a criminal investigation, Saunders wrote the same legal question was relevant to Carroll’s lawsuit — “whether the Supremacy Clause of the Constitution bars a state court from exercising jurisdiction over a sitting President of the United States during his term.”

“No, it does not,” Saunders wrote.

She said the Supreme Court’s ruling applied to “all state court proceedings in which a sitting president is involved,” including those involving the president’s unofficial or personal conduct.

Trump’s lawyers, who did not respond to a request for comment, could appeal the ruling.

For now, the ruling allows the lawsuit to enter the crucial discovery phase, in which both sides will exchange documents and other materials.

Lawyers for Carroll had requested that Trump provide a DNA sample to determine whether his genetic material is on a dress that Carroll said she was wearing at the time of the incident.

The ruling also means Carroll and Trump could sit for depositions under oath in the coming months.

Roberta Kaplan, a lawyer for Carroll, said, “We are now eager to move forward with discovery so that we can prove that Donald Trump defamed E. Jean Carroll when he lied about her in connection with her brave decision to tell the truth about the fact that Donald Trump had sexually assaulted her.”

Some of the findings during discovery could be disclosed publicly in court filings before the election in November, although Trump’s lawyers could seek other avenues to delay the case.

In a book excerpt published last June, Carroll, a longtime columnist for Elle magazine, wrote that Trump threw her up against the wall of a dressing room at Bergdorf Goodman, an upscale department store in Manhattan, and forced himself on her. She said the episode occurred in late 1995 or early 1996.

She had kept the black wool dress that she was wearing that day, she wrote.

Carroll announced earlier this year that she had departed from Elle magazine, saying the magazine fired her after Trump insulted her reputation. Her contract was terminated early, but Elle said it was not about her allegations against him.

Trump has denied Carroll’s allegations. He said he did not know her, even though the two were photographed together at a party in 1987 with Carroll’s former husband. Trump later said the image was misleading.

He also said Carroll had fabricated the episode to sell her book and that she was “not my type.”

Carroll is one of more than 10 women who have accused Trump of sexual misconduct before he was president. Trump has denied all of the accusations.