KUALA LUMPUR (Reuters) - Malaysia has detained seven people for suspected militant-linked activities, including a man who allegedly made death threats against the country’s king and prime minister, police said on Thursday.

The Muslim-majority country has been on high alert since gunmen allied with the Islamic State (IS) militant group carried out a series of attacks in Jakarta, the capital of neighboring Indonesia, in January 2016.

Four Malaysians and three Indonesian men were arrested in four states between July 12 and 17, Inspector-General of Police Mohamad Fuzi Harun said in a statement.

A 34-year-old unemployed man was arrested in the Malaysian state of Johor, north of Singapore, for allegedly posting death threats on social media against Malaysia’s King, Sultan Muhammad V, Prime Minister Mahathir Mohamad, and the minister in charge of religious affairs Mujahid Yusof Rawa.

Police believe the threats were made based on the belief the targets were “un-Islamic leaders, whose methods of ruling the country were not based on Shariah law”, Muhamad Fuzi said.

A 42-year-old technician was picked up for allegedly making threats to launch bomb attacks in Malaysia, Indonesia and the Philippines after the Muslim holiday of Eid al-Fitr.

The other Malaysian suspects were a man and a woman in their 20s. The woman allegedly sent funds to a known Malaysian militant in Syria, while police believe the man had planned to travel to Syria to join the Islamic State, Muhammad Fuzi said.

One of the Indonesians arrested had allegedly pledged allegiance to and received military training from the Islamic State of Indonesia(NII), an Indonesian militant group in Bandung.

Police believe the 26-year-old man, married to a Malaysian woman, had also planned to take his wife and step-children to Syria to join the Islamic State, Mohamad Fuzi said.

Another Indonesian suspect was allegedly linked to a member of Jemaah Ansharut Daulah (JAD) who was involved in the May 10 killing of an Indonesian police officer at the mobile police brigade headquarters in West Java, Muhamad Fuzi said.

A third Indonesian, who police said admitted to being a Islamic State member, was detained for saving about 190 videos and photos of the militant group’s activities on his mobile phone, and uploading similar images to his Facebook account.

Malaysia has arrested hundreds of people over the past few years for suspected links to militant groups, but has never suffered a major attack.

Islamic State took responsibility for a 2016 grenade attack on a bar on the outskirts of Kuala Lumpur, which wounded eight people. It was the first such strike in Malaysia.