(Adds detail, background)
BAQUBA, Iraq, Dec 13 (Reuters) - Masked gunmen shot dead 18 oil and gas workers, most of them Iranians, outside the northeastern Iraqi town of Muqdadiya on Friday, witnesses and officials said.
One worker wounded in the assault told Reuters the attackers sped up in three cars as he and his colleagues were digging a trench to extend a pipeline.
"Three of them got out of a car and started firing on the workers inside and outside the trench," said Ibrahem Aziz by phone from hospital.
No group immediately claimed responsibility for the assault, but officials said it bore the hallmarks of the Iraqi affiliate of al Qaeda which has carried out a string of attacks amid the country's worst spate of violence in five years.
Fifteen Iranians and three Iraqis were killed and a total of eight other workers wounded, medical and local officials said.
Iran signed a deal in July to build a pipeline and import gas into Iraq to fuel power plants in Baghdad and Diyala province, where the attack took place.
In a separate incident, at least five people were killed and 14 wounded when a car bomb exploded in southern Baghdad's outskirts of Nahrawan, police said.
A further six people were killed in a car bomb explosion in the town of Madaen, south of Baghdad, police said. (Editing by Andrew Heavens)