DHAKA (Reuters) - A court in Bangladesh on Tuesday sentenced two militants to death and jailed three for life after finding them guilty of killing a university professor two years ago, a prosecutor said.

The Muslim-majority country of 160 million people has seen a string of violent attacks in recent years targeting liberals, foreigners and religious minorities.

Rezaul Karim Siddiquee, 58, an English professor at northwestern Rajshahi University, was hacked to death in April 2016. Militant group Islamic State claimed responsibility for the killing, accusing him of issuing a “call to atheism”.

The trial court also jailed three men for life, public prosecutor Entajul Haque told reporters, after the verdict was delivered in a packed courtroom.

One of the five, Shariful Islam, a student of the professor and believed to have masterminded his killing, was tried in absentia and received a death sentence, he added.

In November, police charged eight members of the home-grown Jamaat-ul-Mujahideen militant group in the case. Police said three more accused were killed in an exchange of gunfire.

Investigators believe the same group, which has pledged allegiance to Islamic State, was behind a major attack in the diplomatic quarter of Dhaka in July 2016, when gunmen stormed a restaurant, killing 22 people, most of them foreigners.

Islamic State and al Qaeda have claimed a series of killings of liberals and members of religious minorities in Bangladesh in the past few years.

Authorities have consistently ruled out the presence of such groups, blaming domestic militants instead. However, security experts say the scale and sophistication of the restaurant attack suggested links to a wider network.