Authorities in Malaysia have released four students who were being held on suspicion of involvement in terrorism. The four were originally arrested in Pakistan.

The four men were part of a group of 13 Malaysians attending an Islamic school in the Pakistani city of Karachi. Earlier this month, they were deported to Malaysia, where they were arrested under the Internal Security Act, which allows police to hold suspects almost indefinitely without trial.

The other nine are still in custody.

The Malaysian government initially feared that the 13 students might have been in Karachi for training to take over leadership of the Southeast Asian terror group Jemaah Islamiyah, or JI.

In August, Pakistan's police arrested the younger brother of Hambali, an Indonesian and leader of JI.

The relationship among terror groups in Pakistan, Malaysia and Indonesia is complex, but it reflects links forged during the Afghan war with the Soviets two decades ago.

JI is believed to have its roots among Indonesian exiles living in Malaysia during the 1980s and '90s. Although the group has been most active in Indonesia, it has recruited throughout the region and has used Malaysia as a base.

In a related development, Malaysia has also released 15 members of a militant group that three years ago seized weapons and demanded the resignation of the prime minister. The authorities say the men expressed regret and promised not to offend again.

All 19 were released as a goodwill gesture to mark the end of Ramadan, the Muslim holy month, which ends on Tuesday.