WASHINGTON — A leading Republican senator warned Sunday that Iraq was "unraveling" in the wake of the withdrawal of US troops, putting at risk the thousands of American civilians in the country.

Senator John McCain, who lost to Barack Obama in the 2008 presidential election, blamed the deteriorating situation on the Obama administration's failure to leave behind a residual US force.

"I think there's clearly an unraveling going on which could eventually lead basically into three different kinds of states in Iraq," McCain said on CBS television's "Face the Nation."

The last American troops withdrew from the country in mid-December, ending a turbulent, near nine-year occupation and military presence that followed the US-led invasion of the country in 2003.

The US military had hoped to leave behind a residual force to train and advise Iraqi security forces, but negotiations with the Iraqis broke down over legal protections for American troops.

Defense Secretary Leon Panetta earlier on the same CBS show expressed confidence that Iraqi forces were capable of dealing with the security threats and said "our people can be secure in what... they're doing there."

But McCain said the estimated 15,000 US civilians working in the country were not safe.

He warned that if Iraq descends into chaos, "we would have to withdraw them."

"Look, what Secretary Panetta may not understand -- and I have great admiration and respect for him -- is that the situation is unraveling.

"The vice president of Iraq is now hiding out in Arbil. There are militias and death squads operating. There is a breakdown in the Iraqi government. And there are increased tensions on the border between the Kurdish areas and Iraq."