KUALA LUMPUR, Malaysia — Prime Minister Najib Razak of Malaysia has promised to abolish two contentious security laws that allow for detention without trial and to relax a law governing the media in what analysts say is an attempt to revive his public support before elections that could be called by early next year.

Mr. Najib announced on Thursday that he would repeal the laws, the Internal Security Act, which allows indefinite detention, and the Emergency Ordinance. Human rights groups say the laws have been used to silence critics of the government.

He also said that he would propose changes to rules for the media so publications would no longer have to renew their printing licenses annually, and that the government would review laws relating to freedom of assembly.

The two security laws would be replaced with new legislation, Mr. Najib said. “The new law will provide for a substantially reduced period of detention by the police compared to what we have now,” he said. Important details of the legislation have not been released, including how long people might be detained without trial under the new laws.