BAGHDAD — Under heavy pressure from the United States, Iraqi lawmakers took a significant step on Monday by choosing a replacement for Prime Minister Nuri Kamal al-Maliki, widely blamed for their country’s polarized politics. But Mr. Maliki angrily rejected the move, vowing to fight in the courts and perhaps by use of force, throwing the country into new uncertainty even as it fights an onslaught by Sunni militants.

The change in leadership could help soothe Iraq’s sectarian fractures and unite the country under Mr. Maliki’s nominated successor, a member of his own Shiite party. But Mr. Maliki’s insistence that he is the rightful leader could just as easily tear Iraq further apart.

Complicating the picture more was the United States, which helped orchestrate Mr. Maliki’s rise to power eight years ago but now holds him responsible for alienating the country’s Sunni minority and helping fuel the rise of the Islamic State in Iraq and Syria, the Sunni extremist group. Territorial gains by ISIS in the north prompted a new military intervention by the United States — and gave Washington fresh leverage to demand political changes in Baghdad.

President Obama welcomed the nomination of a new prime minister, Haider al-Abadi, interrupting his vacation on Martha’s Vineyard to announce in a televised statement that both he and Vice President Joseph R. Biden Jr. had congratulated Mr. Abadi on the phone, calling his nomination “an important step towards forming a new government that can unite Iraq’s different communities.”