One of the Malaysian suspects is accused of threatening to kill the Malaysian king as well as Prime Minister Mahathir.

Four Malaysians and three Indonesian men with suspected links to the Islamic State of Iraq and the Levant (ISIL), have been detained during a five-day operation across four states in Malaysia, the country’s police chief said.

Malaysian police chief Mohamad Fuzi Harun said in a statement on Thursday that one of the suspects had threatened to assassinate the Malaysian king and Prime Minister Mahathir Mohamad.

Malaysia has been on high alert since gunmen allies with ISIL, also known as ISIS, carried out a series of attacks in neighbouring Indonesia.

A 34-year-old unemployed Malaysian man had issued the death threats against the king, Sultan Muhammad V, and Mahathir, on his personal Facebook account, saying they were not ruling the country in accordance with the principles of what he proclaimed to be Islamic law.

Another 42-year-old Malaysian man threatened on Facebook to carry out multiple bomb attacks in Malaysia, Indonesia and the Philippines after the Muslim holiday of Eid, police said.

The other Malaysian suspects were a man and a woman in their 20s. The woman allegedly sent funds to a known Malaysian fighter in Syria, while police believe the man had planned to travel to Syria to join ISIL.

Meanwhile, the three Indonesian suspects were reported to have connections with domestic Indonesian armed groups, including Negara Islam Indonesia (NII) and Jamaah Ansharul Daulah (JAD).

Malaysia suffered its first ISIL attack in June 2016 when an explosion injured eight people [File: AP]

One of the three Indonesians had reportedly undergone military training in the Indonesian city of Bandung with the NII.

The man reportedly had plans to travel with his Malaysian wife, who had also sworn allegiance to the NII, and stepchildren to Syria to join ISIL.

Another Indonesian man had almost 100 videos and 90 pictures of ISIL-related activities on his mobile phone, according to police.

One of the Indonesian suspects was allegedly linked to a JAD member accused of being involved in the May 10 killing of an Indonesian police officer in Indonesia’s West Java.

Malaysia has arrested hundreds of suspected armed fighters in recent years and suffered its first ISIL attack in June 2016 when a grenade attack at a nightclub in Selangor injured eight people.