Their bullet-riddled bodies were carried into Mogadishu’s Medina hospital after the attack on road leading from the capital to Afgoye, a town some 30 kilometres (20 miles) northwest of the capital.
Doctors at the hospital said the foreigners killed were Syrians.
One Syrian doctor was also wounded in the attack, which took place as the group travelled down the road towards Afgoye, a former stronghold of the Al-Qaeda-linked Shebab insurgents, before they were driven from the town in May 2012.
However, a senior Shebab official said they did not carry out the attack, although their fighters have often carried out shootings, bombings and suicide commando raids against government and international targets, including aid workers.
The region is awash with guns and multiple armed men and militia forces operate in the area, one of the most dangerous places in the world for aid workers.
Somalia has been riven by civil war since the collapse of the central government in 1991.
The Shebab have been driven out of Somalia’s major towns by a UN-mandated African Union force (AMISOM).
However the Shebab still controls large swathes of southern Somalia as well as pockets of Puntland.
On Monday, a new chief of the AU force took over command, vowing he would lead the 17,700-strong force in a fresh offensive against the Shebab, with over 4,000 reinforcements expected.
With extra troops, “AMISOM will be able to expand its area of responsibilities to liberate other locations which are currently in the hands of Al-Shebab,” said new commander Silas Ntigurirwa, a Burundian general.
The Shebab claimed responsiblity for an bloody attack in September on a shopping mall in Nairobi in retaliation for Kenya’s military intervention in Somalia.
Last week, 13 people were killed in four attacks in Kenya during week-long celebrations to mark the country’s 50th anniversary of independence.