President Trump speaks with Russian Foreign Minister Sergei Lavrov last week at the White House. (Russian Foreign Ministry via European Pressphoto Agency)

Intelligence officials say President Trump might have damaged relations with allies, who will now be more cautious in sharing sensitive information with the United States. Democrats say he’s a hypocrite, having lambasted Hillary Clinton for her own handling of classified information. But when Trump spoke about highly classified information with Russian officials in a White House meeting last week, he did not break the law, legal analysts say.

The president is essentially the ultimate arbiter of what is classified and what is not. While the heads of particular agencies also have original classification authority — the power to deem material classified or not classified — their authority is limited to their departments and bound by their departments’ particular rules.

The president, as the head of the executive branch, knows no such restrictions — his power on the matter comes straight from the Constitution, legal analysts say.

“When it comes to classification issues and those kinds of things, he’s not above the law,” said Edward B. MacMahon Jr., a criminal-defense lawyer who has done significant work on cases involving classified information. “He basically is the law.”

Trump’s aides have offered shifting defenses of his disclosure of information, but the president has been clear: What he did was allowed.

“As President I wanted to share with Russia (at an openly scheduled W.H. meeting) which I have the absolute right to do, facts pertaining to terrorism and airline flight safety,” he wrote Tuesday on Twitter. “Humanitarian reasons, plus I want Russia to greatly step up their fight against ISIS & terrorism.” ISIS is an acronym for the Islamic State.

President Barack Obama spelled out guidelines on classified information in an executive order in 2009 — though that was largely targeting agencies, rather than putting restrictions on the president’s authority.

Legal analysts said Trump is right that he committed no crime, though some said it was fair to question his judgment in revealing material to the Russians — especially since it originated with a partner country and could damage intelligence-sharing arrangements.

“He can do it at a whim. There really is no process for it,” said Barry J. Pollack, a white-collar criminal-defense lawyer who has done work on high-profile leak cases, including representing WikiLeaks founder Julian Assange. “He has the ability to do it as he wishes. Whether or not it is a wise practice or whether it will cause diplomatic or intelligence-gathering concerns obviously are other issues, and most presidents would consult with the intelligence community before choosing to declassify it.”

The president’s revelation of information to Russia does not mean he has declassified the material he discussed, analysts said. Obama’s executive order explicitly allows the dissemination of classified information to a foreign government in accordance with the “direction of the President” — though it does not say such material is automatically declassified.

MacMahon said that when he was defending Sept. 11, 2001, conspirator Zacarias Moussaoui, he wanted to enter into pleadings information about Guantanamo Bay detainees that at the time was classified. After President George W. Bush mentioned the detainees in his State of the Union address, MacMahon said, he inquired with the government about whether that material was now public.

“The answer was no,” MacMahon said.

Other people can be charged with crimes for revealing classified information. Former CIA officer Jeffrey Sterling, for example, was convicted under the Espionage Act for revealing to a New York Times reporter details of a secretive operation to give faulty nuclear plans to Iran. Former CIA director David H. Petraeus pleaded guilty to a misdemeanor charge of mishandling classified materials for letting his mistress and biographer access highly sensitive information in notebooks he kept.

MacMahon, who represented Sterling, said prosecutors could probably pursue a case against those who talked to reporters about the president’s revelation — even if they could not charge the president.

“Whatever it was that was said at this meeting, if somebody asks me if a crime was committed, I’d say by the person who disclosed it to the media,” he said. “That’s who violated the law.”

The Justice Department’s Office of Legal Counsel has opined in the past that the president cannot be indicted or prosecuted at all, “because it would impermissibly interfere with the President’s ability to carry out his constitutionally assigned functions and thus would be inconsistent with the constitutional structure.” Trump could be impeached for “treason, bribery, or other high crimes and misdemeanors,” and in previous impeachment proceedings, Congress has cited presidents with violating the oath of office.

Taken on its own, though, Trump’s revelation of classified information to the Russians would seem to fall well short of that, MacMahon said.

“Now whether it’s wise for a president to do that,” he said, “that’s a different judgment.”