The Prevention of Terrorism Act allows authorities to detain terrorism suspects without charge, and the political opposition as well as legal and rights groups had urged its withdrawal.
“It introduces long-term detention without trial, is open to abuse and is a grievous blow to democracy,” opposition lawmaker N. Surendran said.
Authorities have expressed increasing alarm in the wake of the Islamic State (IS) group's bloody jihad in Syria, which police say has drawn dozens of recruits from traditionally moderate, Muslim-majority Malaysia.
On Monday, police said 17 people, including two who recently returned from Syria, had been arrested on suspicion of plotting terror attacks in the capital Kuala Lumpur. No further details were given.
The legislation was passed after midnight, following 15 hours of debate, according to media reports. Its passage was not in doubt due to the ruling regime's majority in parliament.
The terrorism act has heightened worries in Malaysia over a deepening crackdown on civil liberties launched by the government in the wake of a 2013 election setback.
The ruling United Malays National Organisation (UMNO) has been in charge since 1957, but faces possible defeat at the hands of an opposition that has campaigned against government corruption and alleged abuse of power.
Dozens of government critics, including opposition politicians, academics, activists, and journalists, have been hit with sedition or other charges after criticising the regime.
In particular, the terrorism legislation has revived concerns of a return to a previous draconian Internal Security Act (ISA) that allowed detention without trial -- and was repeatedly used against opposition politicians.
The ISA was scrapped in 2012 amid public pressure for political reform.
The government did not immediately respond to a request for comment, but has said previously the law would not be used against anyone over their “political” views.
Police said in January they had arrested a total of 120 people with suspected ISIS links or sympathies, or who had sought to travel to Syria or Iraq.
They also said 67 Malaysians were known at the time to have gone abroad to join IS jihadists, and that five had died fighting for the movement.
Source: AFP