In June 1981 Mahathir became prime minister, minister of home affairs, and minister of justice after Hussein Onn stepped down for health reasons and turned over the leadership of UMNO and the ruling Barisan coalition. Confident of his abilities and bolstered by popularity resulting from his "clean, efficient, smooth government" campaign, Mahathir called an early general election in April 1982 and won a landslide victory for UMNO in the House. Indeed, Mahathir's popularity returned the Barisan coalition to a 148-seat majority in the House in the 1986 federal and state elections and also gave it an absolute majority in simultaneous elections in all 11 peninsular Malay state assemblies.
In 1987 Mahathir faced a crisis in the party when Deputy Prime Minister Musa Hitam and former minister of trade and industry Tengku Tan Sri Razaleigh Hamzah challenged his leadership of the party in the intraparty elections. Mahathir
won a bare majority of the party's leadership, but questionable campaign practices led to the party's being declared illegal by the High Court. Mahathir reregistered the party in March 1988 as UMNO ( Baru ) and forced his opponents out of the party in doing so. Meanwhile, Mahathir had cracked down on opposition outside the party by invoking the Internal Security Act in October 1987 and ordering the arrest of some 106 political opponents, Islamic fundamentalists and Chinese nationalists, and by closing four newspapers.
In 1983 Mahathir took on the nation's sultans in a constitutional battle whereby he tried to limit the powers of the royalty within their home states and to remove the power of the king to veto government legislation passed by the House. After a yearlong heated battle, Mahathir won the power of a parliamentary override of the king's veto, but the king kept the veto and the power to declare national emergencies. In the process of taking on the popular royalty, Mahathir lost some of his approval.