TEHRAN — Iran’s supreme leader on Wednesday publicly endorsed for the first time the July nuclear agreement between Iran and six world powers, state news agencies reported. But the provisional endorsement was accompanied by a warning that Tehran expected all sanctions to be lifted or it would walk away from the deal.

The support of the supreme leader, Ayatollah Ali Khamenei, is the final step in an approval process involving the Supreme National Security Council, the Iranian Parliament and the Guardian Council. Iran can now begin carrying out the measures outlined in the agreement, including dismantling thousands of centrifuges used for enrichment and downsizing a heavy water plant so it can no longer produce plutonium.

The endorsement was included in a letter addressed to President Hassan Rouhani that included accusations against the United States, Iran’s longtime enemy, and pointed out several flaws in the deal, state television reported.

Calling for close supervision of the application of the agreement, the Joint Comprehensive Plan of Action, Ayatollah Khamenei said the deal “suffers from several ambiguities, and structural weaknesses.” He added that without close oversight, the deal would lead to “great damage to the present and future” for Iran.