By Tim Arango

New York Times News Service

BAGHDAD — Prime Minister Nouri al-Maliki said Thursday night that he had agreed to relinquish power, a move that came after days of crisis in which his deployment of extra security forces around the capital had raised worries of a military coup.

Al-Maliki’s decision held out the prospect of a peaceful transition of power, based on democratic elections and without the guiding hand of U.S. military forces, which would be a first in modern Iraq’s troubled history of kings, coups and dictatorships.

His decision to step aside came after heavy pressure from the United States, which has deployed warplanes in Iraq to target Sunni Islamist militants and suggested that more military support would be forthcoming if al-Maliki was removed from power. Iran also played a decisive role in convincing al-Maliki that he could not stay in power.

Al-Maliki, 64, agreed to end his legal challenge to the nomination of his replacement, Haider al-Abadi, 62, a member of al-Maliki’s own Dawa Party, who was chosen Monday by Iraq’s president.

On state television, standing next to al-Abadi and other party leaders and reading from a prepared text, al-Maliki said, “I announce before you today, to facilitate the political process and to form a new government, that I withdraw my candidacy in favor of the brother Dr. Haider al-Abadi, and all that goes with that in order to preserve the high interests of the country.”

Now that al-Maliki is leaving, the crucial question, given Iraq’s many divisions, is if al-Abadi, a Shiite like al-Maliki, can rise above sectarianism and be a truly national figure. He will try to stitch together a national unity government that establishes a new political bargain among Iraq’s three main communities — the majority Shiites and the minority Sunnis and Kurds. The United States has insisted on a political solution so Iraq’s leaders can present a united front against the onslaught by Islamic State, which has seized control of large portions of northern and western Iraq.

In a statement Thursday evening, Susan Rice, President Barack Obama’s national security adviser, praised al-Maliki for his decision and said the United States was encouraged by the progress Iraqis had been making in building a new government.