Three American contractors kidnapped from a party at their translator’s house in Baghdad about a month ago have been freed and handed over to the US embassy.

The men are in good health and have been delivered to US officials, Iraqi officials said.

They were the first US citizens abducted in Iraq since the withdrawal of American troops in 2011, but the country still has a big problem with criminal abductions for ransom and political kidnappings. Several foreigners including Turks and Qataris have been seized in recent months.

“We sincerely appreciate the assistance provided by the government of Iraq and its whole-of-government effort to bring about the safe release of these individuals,” said Mark Toner, a deputy spokesman at the US embassy.

Iraqi and western officials suspected the Americans had been taken by one of Iraq’s powerful Shia militias and the search for them focused on Sadr City, a sprawling and largely Shia neighbourhood.

The three Americans were working for a small company under General Dynamics Corp, which has a contract with the US army, sources said. They were enjoying a quiet dinner with mezze and whisky at their translator’s apartment in the suburb of Dora, where they had travelled without official permissionwhen a group of militiamen arrived and abducted them.

“They were not making any noise or doing anything antisocial,” one of the intelligence officials tracing the men said.

Dora was one of many Baghdad flashpoints during the sectarian war that consumed parts of the city between 2005 and 2007. A decade later, the Iraqi capital remains tense and riddled with checkpoints.

The area where they were kidnapped is known as Abu D’sheer and is guarded by Iraqi police and the Asa’ib ahl Al-Haq militia, which has close connections with the country’s security apparatus.

The last US citizen kidnapped in Iraq before this incident was in 2010, when an Iraqi-American translator was seized and released after two months.

Turkish construction workers were abducted in Sadr city on 16 September last year before being released about a month later in the southern city of Basra. Their kidnappers demanded a halt to oil sales out of Iraqi Kurdistan, made in defiance of Baghdad.

A group of Qatari hunters who had crossed from Saudi Arabia were detained in Iraq’s southern deserts late last year and their whereabouts remain unknown.