NEW YORK — A state court judge on Monday issued an 11th-hour ruling affirming Simon & Schuster's right to publish an explosive new book by President Trump's niece, issuing a decision that prioritizes the First Amendment over a dated confidentiality agreement among members of the Trump family.

The book by Mary L. Trump — “Too Much and Never Enough: How My Family Created the World’s Most Dangerous Man” — is slated for release Tuesday. Some copies already have been distributed, and the work is already considered a bestseller.

“The court got it right in rejecting the Trump family’s effort to squelch Mary Trump’s core political speech on important issues of public concern,” her attorney Theodore J. Boutrous Jr. said in a statement. “The First Amendment forbids prior restraints because they are intolerable infringements on the right to participate in democracy.”

Mary Trump, 55, was sued by her uncle Robert Trump, the president’s brother, in an effort to block publication. He had accused her of violating a confidentiality agreement in an inheritance case settled two decades ago.

A lawyer for Robert Trump did not immediately respond to a request for comment. He could attempt to seek monetary damages from his niece, but it is unclear whether he intends to do so.

In Dutchess County, N.Y., Justice Hal Greenwald said that Simon & Schuster had no obligations under the family’s nondisclosure agreement and that constitutional law “trumps contracts.”

The agreement was signed as the family settled the estate of the president’s father, Fred Trump. Lawyers for Mary Trump had argued it was meant to keep details of the settlement private and does not bar Mary Trump from telling her famous family’s story outside of that. They had said, too, that the book’s content was vital to the country’s democratic process, saying in court filings that “the speech at issue concerns vital political discourse directly relating to an ongoing national election.”

The book has struck a nerve with the president and his family. Mary Trump is the daughter of Fred Trump Jr., the president’s brother, who died in 1981 when she was 16 years old. A clinical psychologist, she has said she employed her professional training in analyzing the president and the “toxic” environment in which he was raised.

In his ruling, Greenwald reasoned that Mary Trump, under her contract with Simon & Schuster, had no ability to halt publication, saying it would have been “moot” to order her to stop publication of a book that “has been published and distributed in great quantities” already.

The judge refused to apply a broad view of the estate settlement, saying that “what was confidential was the financial aspect.”

“The parties agreed to keep the settlement under seal. That’s it,” Greenwald wrote of the deal that was executed at a time when “the Trump family were New York based real estate developers and not much else.”

The Trumps “were not elected officials or TV personalities,” Greenwald said in the ruling. “The issues that were the subject of the Agreement were intra family issues, not of worldwide concern, or even national interest.”

Greenwald suggested the case to stop publication was also weak because it was brought by Robert Trump, even though the book focuses largely on the president.

In a statement, Simon & Schuster said: “The unfettered right to publish is a sacred American freedom and a founding principle of our republic, and we applaud the Court for affirming well-established precedents against prior restraint and pre-publication injunctions.” Mary Trump’s book, the publisher added, is “a work of great significance, with very real implications for our national discourse.”

The book, an advance copy of which was obtained by The Washington Post, portrays Fred Jr.’s death as a defining moment for the president, who was said to have dealt with his brother harshly as he pushed him into the family real estate business. Fred Jr. was preoccupied with pursuing aviation as his family, including the future president, pressured him to focus on the family business.

Mary Trump labels the president a “sociopath” in the book, citing his efforts to win over his difficult father. The memoir paints the family patriarch as a malignant figure who largely created and shaped the future president. Both men’s business records have been questioned extensively, dogged by a number of cheating accusations spanning decades.