WASHINGTON — The Trump administration is pressuring Iraq to stop buying energy from its neighbor and sole foreign supplier, Iran, in what has become a major point of conflict between Washington and Baghdad.

Iraqi leaders, fearing that a further shortfall in power would lead to mass protests and political instability in their electricity-starved country, are pushing back on the demand, which is rooted in President Trump’s sanctions against Iran.

The dispute has frayed American diplomacy with Baghdad as Iraq tries to steady itself after the United States military withdrawal in 2011 and the campaign against the Islamic State.

Iraq’s defiance further jeopardizes Mr. Trump’s goal of getting all nations to comply with sanctions after withdrawing from the deal to limit Tehran’s nuclear program last year. Already, European nations have set up a legal financial mechanism to do business with Iran, and China and India are resisting American efforts at prodding them to cut off oil purchases.