The U.S. military transferred control of its sprawling headquarters outside Baghdad to the Iraqi government Friday, a deeply symbolic moment that launched the final month of a nearly decade-long U.S. presence.

The last few soldiers at Camp Victory, a base that once housed 68,000 military personnel and contractors, departed early Friday afternoon. There are currently 12,000 U.S. troops left in Iraq at five bases, down from a peak of 170,000 at 500 bases in 2007, military spokesman Col. Barry Johnson said. All will be gone by the end of the year.

“There was a signing of papers of receivership that gave Iraq custody of the base effective today,” Johnson said. “It’s quite nostalgic. It was the center of gravity for what we were doing here for all these years,” he added.

On Thursday, Vice President Biden and Iraqi Prime Minister Nouri al-Maliki urged Iran not to attempt to exploit the departure of U.S. troops to expand its own influence. They spoke during a ceremony intended to mark the end of the Iraq war at Camp Victory’s marbled al-Faw Palace, built by Saddam Hussein and converted into the nerve center of American power in Iraq for the past 81 / 2 years.

Concerns that neighboring Iran will seek to fill the vacuum left by the departing Americans are foremost in the minds of U.S. policymakers as the war comes to a close. Upheaval in the region threatens to reignite the sectarian divide between Iraq’s dominant Shiites and the Sunnis ousted from power by the U.S. invasion.

Biden, who is on an unannounced visit here, referred to Iran in his speech to the gathering of top Iraqi officials, lawmakers and U.S. and Iraqi troops, saying he was confident Iraq did not want to substitute domination by one foreign power for that of another.

“The Iraqi people will not, have not, and will not again yield to any external domination, and they would never abide another nation violating their sovereignty by funding and directing militias that use Iraqi terrain for proxy battles that kill innocent Iraqi civilians,” he said.

“Militias” is the term U.S. and Iraqi officials use to refer to the Shiite groups that took up arms in the early years of the war with support and funding from Shiite Iran. Some have continued to attack Americans even as they leave, targeting convoys with roadside bombs and firing rockets at the dwindling number of U.S. bases.

Maliki echoed the same sentiments in his speech, alluding to the way the Iranian-backed groups have cited the presence of America’s troops to justify violence.

“The withdrawal operation will take away all the slogans that some countries hide behind in order to interfere in the internal affairs of Iraq,” he said.

Reflecting concerns that some of Iraq’s other powerful neighbors, including Sunni Saudi Arabia and Turkey, will also compete to influence Iraq, Maliki said he wanted good relations with “all brotherly and friendly countries, especially the neighboring countries.”

As the ceremonies got underway, 20 people were reported killed in two separate attacks in the province of Diyala. A car bombing killed 13 people, and an attack on the homes of three Sunni Awakening fighters killed seven others, provincial police said.

The ending of the war “doesn’t mean that the threats are over,” Biden said. “But Iraqi security forces have been well-trained, prepared, and you are fully capable of meeting the challenges.”