Seven children, six women and three old men were among the dead,
witnesses said, while the injured included 13 children, seven women and two old men.
The witnesses added that the shelling started after US forces, who landed near al-Qaim on Monday night, came under repeated attack.
Early reports indicated one house was completely destroyed and three others partially damaged in the bombing, according to Aljazeera.
On Monday, five car bombs hit US military targets in the western Iraqi city of al-Qaim near the border with Syria, wounding at least two US soldiers.
Separately, the US embassy in Iraq announced that an American contractor working in a reconstruction project had been captured.
Iraqi journalist Ahmad Khalid told Aljazeera two of Monday's attacks in al-Qaim were simultaneous. Three bombs hit a building used as US military headquarters while a fourth targeted a US troop convoy.
Al-Qaim on the border with Syria
has seen frequent gun battles
Clashes erupted later between fighters and US soldiers in the city, damaging a number of houses, the journalist said.
However, no civilians were injured in those clashes as they had fled.
A spokesperson for the US Marines said on Monday three of their soldiers were wounded in the attack, which occurred outside Camp Gannon, a base in al-Qaim, about 300km west of Baghdad in Anbar province.
Late on Monday, armed men opened fire on a police patrol in the northern Iraqi city of Kirkuk, injuring two members of the security service, police Brigadier Sarhat Kadir said.
Attackers also placed a bomb in the undercarriage of a doctor's car, but the device exploded as the physician entered a Kirkuk store to buy bread, sparing him but wounding two nearby civilians, Kadir said.
It was not known why the attackers targeted the doctor.
"It is the government's opinion that, together with the end of the UN mandate for the stabilisation mission, all the activity of the Polish stabilisation mission should also end"
Polish Defence Minister
Meanwhile, Poland's defence minister has said the government wants its troops to leave Iraq in the first weeks of 2006 after the authorising UN resolution expires.
"It is the government's opinion that, together with the end of the UN mandate for the stabilisation mission, all the activity of the Polish stabilisation mission should also end," Defence Minister Jerzy Smajdzinski said.
Poland, one of Washington's closest allies in Europe, runs a multi-national stabilisation force in south-central Iraq, where it has about 1700 soldiers.