Gunmen in army uniforms have swooped on a village south of Baghdad, stormed three houses and massacred 20 men and five women from families linked to an anti-Qaeda militia, an interior ministry official said.

A security spokesman has blamed Al Qaeda for the pre-dawn attack and and says 17 people have been arrested in connection with the murders.

The brutal killings come as Iraq's political parties negotiate to form a government, nearly a month after parliamentary elections.

The interior ministry official, speaking on condition of anonymity, said witnesses had told security forces the killers entered the village just before midnight Friday (local time), and carried out the murders about two hours later.

They tied up their victims before killing them in a rampage of violence, the worst against anti-Qaeda fighters since November 16 when 13 members of a tribe opposed to the jihadists were murdered west of Baghdad.

A defence ministry official has confirmed the details of the attack and the toll.

"Our information is that the killers were from Al Qaeda," said Major General Qassim Atta, spokesman for the Iraqi security force's Baghdad operations, who put the death toll at 24 - 19 men and five women.

General Atta says seven civilians who had been discovered handcuffed in the village have been freed.

According to the defence ministry official, the targeted families were part of the Sahwa [Awakening] movement, known as the Sons of Iraq by the US army.

The group joined American and Iraqi forces in 2006 and 2007 to fight against Al Qaeda and its supporters, leading to a dramatic fall in violence across the country.

Control of the Sahwa passed to Iraqi authorities in October 2008 and since January 2009, their wages - said to have been cut from $US300 under US leadership to $US100 - have been paid, often late, by the government.

The Sahwa are regular targets of Al Qaeda, which remains active in the country.

Hour Rajab is a mainly agricultural region on Baghdad's outskirts, mostly populated by the Jubur and the Janabat tribes.

Though the frequency of attacks has dropped significantly across Iraq since its peak in 2006 and 2007, the number of Iraqis killed in violence last month was the highest this year.

Altogether 367 people died as a result of attacks in March, the fourth consecutive month in which the overall number of people killed was higher than the same month a year previously.

Saturday's violence comes as Iraq's two biggest political blocs - the Iraqiya list of ex-premier Iyad Allawi and the State of Law Alliance of sitting prime minister Nuri al-Maliki - battle to form coalition governments, more than a week after results from the March 7 polls were released.

Both American and Iraqi security officials have warned that a lengthy period of government formation could give insurgent groups and Al Qaeda an opening to carry out attacks.

-AFP