Updated

Vice President Joe Biden said Thursday that the U.S. should make sure Iraq's stability and democracy are strong enough to make it "a country that was worthy of the sacrifices" the American military suffered during eight years of war.

Biden, speaking to some 400 soldiers in Baghdad, also said the U.S. would continue to train and equip Iraqi forces beyond 2011. His remarks highlighted continuing uncertainty about whether all American troops will head home by the end of the year as required by a security agreement between the two nations.

"The Iraqi people for the first time, I suspect, I would argue, in their history are on the verge of literally creating a country that will be democratic, sustainable and, God willing, prosperous," Biden told the troops at the military's headquarters on the outskirts of Baghdad. "It could have a dramatic impact on this entire region, and God knows the Iraqi people deserve it."

The White House has promised to end the war responsibly. "By that we meant we were going to end this by bringing you all home within a time certain, but leaving behind a country that was worthy of all the sacrifices that so many of your brothers and sisters have made," Biden told the troops.

More than 4,400 U.S. troops have died since the 2003 invasion and an estimated 32,000 have been wounded.

Biden's trip marks the first visit by a top U.S. official since Iraq approved a new Cabinet last month, breaking a political deadlock and jump-starting its stalled government after March's inconclusive elections. But lingering security challenges remain: On Thursday, three bombings in the capital killed two people.

The address to U.S. troops capped a daylong series of meetings in Baghdad, including a session with Prime Minister Nouri al-Maliki. Biden then traveled to Irbil in northern Iraq to meet with Kurdish President Massoud Barzani.

Under a security agreement between Washington and Baghdad that was hammered out in 2008, all American troops are to leave Iraq by the end of the year. However, Iraq's top military commander, Gen. Babaker Shawkat Zebari, has said U.S. troops should stay until Iraq's security forces can defend its borders — which he said could take until 2020.

An aide to Biden said the vice president reiterated Washington's longtime position that the Americans would listen to any request by the Iraqi government for troops to stay longer but that Baghdad has not yet asked them to do so. The official did not want to be identified because of the sensitivity of the talks.

Al-Maliki, under pressure from hardline Shiite Muslims, has signaled he wants American troops to leave on schedule. Last weekend, the influential and anti-American cleric Muqtada al-Sadr returned to Iraq after nearly four years of exile in Iran, in part to insist that the U.S. "occupiers" must leave on time or face retribution among his followers "by all the means of resistance."

A spokesman for al-Maliki, Ali al-Dabbagh, said both sides during the meeting between his boss and Biden "committed themselves to the date of withdrawal" and emphasized that the departure date of U.S. troops is fixed.

Iraq must walk a careful line, balancing its relationship with the United States and its Shiite-majority neighbor, Iran, to the east. Iran views a continued U.S. military presence along its western border with suspicion and is believed to be lobbying its Iraqi allies to adhere to the timeline.

Both Washington and Baghdad had refused to discuss publicly any possibility of U.S. troops staying until after Iraq installed its new government. Biden congratulated Iraq on accomplishing that political feat, which took months of negotiations.

"I'm here to help the Iraqis celebrate the progress they've made. They've formed a government and that's a good thing," Biden told reporters before meeting with U.S. ambassador James F. Jeffrey and U.S. commander Gen. Lloyd Austin at the U.S. Embassy in Baghdad.

About 47,000 U.S. forces remain in Iraq, and American military leaders have said privately they will need to start planning by early spring on how to get them home unless told otherwise.

Keeping troops in Iraq presents political headaches both for President Barack Obama, who is up for re-election next year and promised to end the war in his 2008 campaign, and for al-Maliki, who held onto a second term as prime minister only with al-Sadr's support.

The visit is Biden's seventh since January 2009. He arrived in Iraq after stops in Afghanistan and Pakistan, where the U.S. has refocused its efforts against al-Qaida and allied extremist groups that threaten American security.

Biden was last in Baghdad in September for a military ceremony at the end of U.S. combat operations in Iraq.