KUALA LUMPUR - Malaysia's parliament has approved a five-year extension of a controversial anti-terrorism law that allows for detention of up to 28 days without trial following a lively debate.

The extension of Security Offences (Special Measures) Act 2012, or Sosma, was passed late on Tuesday (April 4) with 93 MPs for and 77 against, The Star reported.

Deputy Home Minister Datuk Nur Jazlan Mohamed had argued that Sosma, which was introduced in 2012, was needed to protect national security.

Sosma replaced the controversial Internal Security Act that allowed for detention of up to two years without the suspect being produced in a court of law.

Under Sosma, a suspect must be produced in court after being detained without legal representation for 28 days.

Between 2012 and this year, 989 people were detained, said Nur Jazlan.

"Out of this, 376 people have been released. So, the question that these people have been detained for a long period of time does not arise," he said.

"A total of 139 people are also undergoing trial while 502 people have been sentenced," he said.

But opposition lawmakers questioned the need for the Act to be extended for another five years, with some arguing that it had been abused and even used against dissent.

The Malaysian authorities had invoked Sosma to detain Ms Maria Chin Abdullah, chief of electoral reforms group Bersih, for 28 days without trial on Nov 19.

She was arrested on the eve of the Bersih 5 rally for attempting to commit "activities detrimental to parliamentary democracy", police said.

The move led to accusations that the government had reneged on its pledge never to use the law against political dissent.

On Tuesday opposition MPs voiced their disagreement over the motion to extend Sosma.

As the clock slowly ticked towards 11pm, Speaker Tan Sri Pandikar Amin Mulia finally stepped in and ordered for the matter to be put to the vote.

Opposition lawmakers then requested for a bloc vote.

Sosma came into effect on July 31, 2012. The five-year extension term will begin from July 31.