Reports say that the kidnappers demanded to see the hostages' identity cards, and released only those identified as Sunni Arabs.
Witnesses said that two people who tried to escape were shot dead.
In addition to the 30 hostages released, Iraqi police freed another 17 after storming a farm compound north of Baghdad.
Elsewhere, police said that at least 25 people have been executed in the northern city of Mosul so far this week.
(AFP, AP, Reuters)
RFE/RL Iraq Report
SUBSCRIBE For weekly news and analysis on Iraq by e-mail, subscribe to "RFE/RL Iraq Report."