Four anti-government protesters in Bahrain were sentenced to death on Thursday by a military court over the killing of two policemen when violence erupted in the capital last month.

The ruling means the four men could be the first to face a firing squad in Bahrain since 2007. It has dismayed human rights activists who claim the men did not receive a fair trial, and the British Foreign Office urged Bahrain "to ensure that due process is carefully and transparently followed in all cases, particularly where severe penalties are proposed".

The defendants' lawyer, Mohammed al-Tajer, was arrested in the runup to the hearing, and Nabeel Rajab, president of the Bahrain Centre for Human Rights, said his replacement may not have had enough time to prepare for such a serious case. He added the decision to try the civilians in a military court which is ultimately controlled by Bahrain's ruling family breached norms of international human rights.

The condemned men were named as Ali Abdullah Hassan al-Singees, Qasim Hasan Matar Ahmad, Saeed Abduljalil Saeed, and Abdulaziz Abdulridha Ibrahim Husain. Three other men, Isa Abdullah Kadhem Ali, Sayyed Sadiq Ali Mahdi and Husain Jaafar Abdulkareem, were sentenced to life in prison over the deaths of the two policemen.

Rajab said the men were well-known anti-government protesters from villages in Bahrain, and he believed they were targeted because of that. They all pleaded not guilty on charges of premeditated murder of government employees.

The government said the convicted men have the right to appeal before the national safety court of appeal, established as part of the imposition of martial law in March.

"Kashef Ahmed Mandhoor and Mohammed Farooq Abdulsamad were murdered last month when they were deliberately hit by vans and run over in one of the most gruesome murders in Bahrain," said a statement from Bahrain's state news agency. "The killing was captured on camera and displayed on TV networks and on social networks Facebook and YouTube. The defendants had all their legal rights in line with human rights standards and had lawyers representing them during the trial. They were also allowed to contact their families. The trial sessions were attended by representative from human rights organisations and relatives of the defendants."

But the fairness of the trial was questioned by Human Rights Watch.

"There is a lack of transparency and there is every reason to think there has been a shocking lack of due process," said Joe Stork, deputy director of the Middle East and North Africa for the campaign group.