BAGHDAD — Moktada al-Sadr, a firebrand militia leader whose forces once battled American troops in Iraq and were implicated in widespread atrocities against civilians, has emerged as the surprise front-runner in the Iraqi national elections, according to Iraqi election officials.

After American forces withdrew from Iraq in 2011, Mr. Sadr remained vocally anti-American, though he has also been strongly critical of Iran, the other foreign power with widespread influence here.

The victory of Mr. Sadr’s political coalition could complicate the American strategy in Iraq. The American military has been training, sharing intelligence and planning missions with former militias in the country, gambling that their military partnership can keep the Islamic State from making a comeback here.

Mr. Sadr has been highly critical of American airstrikes in the country against the Islamic State, though he has said little recently about his willingness to allow American troops to remain on Iraqi soil.