He has said repeatedly that the United States spent $7 trillion in the Middle East since 9/11 and had gotten nothing out of it, a figure that fact checkers have deemed false. He may be taking that number from a study by the Watson Institute for International and Public Affairs at Brown University that estimated future debt from war spending by 2053 at $7.9 trillion. For “war-related activities” in Iraq, Afghanistan and Pakistan since 2001, the institute says the cost has been $1.88 trillion.

Either way, of course, it is a lot of money, and Mr. Trump essentially enshrined this point in a letter that was sent a few weeks ago to the leaders of Saudi Arabia, Egypt, the United Arab Emirates and Bahrain, according to the person familiar with it. Mr. Trump talked about the need for the allies to work together with the United States to strengthen their united front against Iran and urged them to resolve a dispute with their neighbor, Qatar, that has led to a blockade.

After receiving a response from the Arabs, Mr. Trump then sent a second letter about a week ago reinforcing the points. It was not clear what specific steps might follow. He made a vague offer to send a team to help resolve the Qatar conflict if it would be helpful, but the Arab states have resisted the idea, saying it was for them to handle.

The existence of the first letter was made public on Wednesday by Iran’s supreme leader, Ayatollah Ali Khamenei, who appeared intent on using it to undermine the Sunni Arab states that received it. He posted a message on Twitter jabbing the Arabs a day after Mr. Trump announced that he was pulling the United States out of the 2015 nuclear agreement with Iran.

“A few days ago Trump wrote a letter to leaders of #PersianGulf states, which was revealed to us,” the supreme leader wrote. “He wrote: ‘I spent $7 trillion and you must do something in return.’ The U.S. wants to own humiliated slaves.”