Three masked gunmen have killed a Japanese man in Bangladesh, the second foreign national to be killed there within a week, raising alarms among the country's foreign community.

Police said they had detained four suspects in connection with the shooting on Saturday of Kunio Hoshi, 65, in Rangpur district, 335km north of the capital, Dhaka, in an attack similar to the shooting on Tuesday of Italian national Cesare Tavella.

"This [Hoshi's] killing was also carried out by three masked men who came by motorcycle and used a pistol, so the motives may be same," Home Minister Asaduzzaman Khan told Reuters.

Bangladeshi secular writers feel threatened after blogger death

Attacks on foreigners are rare in Bangladesh. But it has seen a rising tide of far-right violence over the past year, in which four online critics of religious groups were hacked to death, among them a US citizen of Bangladeshi origin.

Western embassies, the Japanese and South Korean embassies have all issued various warnings for diplomats and citizens to be extra vigilant about their personal security.

US ambassador to Bangladesh, Marcia Bernicat, said in a statement that she was saddened by the latest killing.

"I urge the government of Bangladesh to investigate every aspect of this crime and to bring the perpetrators to justice as soon as possible," she said.

One of the four detained people was a rickshaw puller, and another was the owner of a residence near where the attack took place, police said.

Security will be increased at foreign diplomats' and foreign nationals' homes and workplaces, a high-level meeting decided on Saturday, Inspector General of Police AKM Shahidul Hoque said.

Authorities are still investigating the death of the Italian national, who was shot dead while jogging inside Dhaka's diplomatic area.

Bangladesh, where most of the population is Muslim, has been struggling in recent months with a rise in violence claimed by far-right groups, banning several that have been blamed for killing four bloggers this year.

Source: Agencies