WASHINGTON — A New York City judge has dismissed a claim by Donald Trump’s brother that sought to halt the publication of a tell-all book by the president’s niece.

In a ruling handed down on Thursday, Judge Peter Kelly said the Surrogates Court lacked jurisdiction in the case.

Mary Trump is the daughter of Fred Trump Jr., the president’s elder brother, who died in 1981. An online description of her book, “Too Much and Never Enough: How My Family Created the World’s Most Dangerous Man," says it reveals “a nightmare of traumas, destructive relationships, and a tragic combination of neglect and abuse.”

The motion filed earlier this week sought an injunction to prevent Mary Trump and the book’s publisher, Simon & Schuster, from releasing it, as scheduled, in July.

Robert Trump’s lawyers filed court papers arguing that Mary Trump and others had signed a settlement agreement that would prohibit her from writing the book. The settlement decades ago included a confidentially clause explicitly saying they would not “publish any account concerning the litigation or their relationship,” unless they all agreed.

The agreement related to the will of Donald Trump’s father, New York real estate developer Fred Trump.

But the judge said the issue was not one for surrogate's court, where disputes over estate matters are settled.

Mary Trump's attorney, Ted Boutrous Jr., said the court was correct in its decision.

“We hope this decision will end the matter. Democracy thrives on the free exchange of ideas, and neither this court nor any other has authority to violate the Constitution by imposing a prior restraint on core political speech,” he said in a statement.

The White House did not have an immediate comment Thursday.