WASHINGTON — President Trump boasted about highly classified intelligence in a meeting with the Russian foreign minister and ambassador last week, providing details that could expose the source of the information and the manner in which it was collected, a current and a former American government official said Monday.

The intelligence disclosed by Mr. Trump in a meeting with Sergey V. Lavrov, the Russian foreign minister, and Sergey I. Kislyak, the Russian ambassador to the United States, was about an Islamic State plot, according to the officials. A Middle Eastern ally that closely guards its own secrets provided the information, which was considered so sensitive that American officials did not share it widely within the United States government or pass it on to other allies.

Mr. Trump’s disclosure does not appear to have been illegal — the president has the power to declassify almost anything. But sharing the information without the express permission of the ally who provided it was a major breach of espionage etiquette, and could jeopardize a crucial intelligence-sharing relationship.

In fact, the ally has repeatedly warned American officials that it would cut off access to such sensitive information if it were shared too widely, the former official said. In this case, the fear is that Russia will be able to determine exactly how the information was collected and could disrupt the ally’s espionage efforts.