Malawi's President Peter Mutharika arrives to cast his vote at a polling station near Blantyre, Malawi, Tuesday, May 21, 2019. More than 6 million Malawians are voting Tuesday for president, parliament and local councils in the country's sixth election since the 1994 end of dictatorship. (AP Photo/Thoko Chikondi)

BLANTYRE, Malawi (AP) — Malawi's President Peter Mutharika has narrowly won re-election with 38% of the votes in last week's polls, the electoral commission declared Monday.

Mutharika's victory was announced in Blantyre, Malawi's largest city, immediately after the High Court in Lilongwe, the capital, threw out an injunction preventing the electoral commission from announcing the winner.

The ban was obtained on Saturday by opposition candidate Lazarus Chakwera, who came in a close second with 35% of the votes. Former Vice President Saulos Chilima came in third with 20% of the ballots.

The other four presidential candidates collectively got nearly 6% of the vote.

In the parliamentary elections, Mutharika's Democratic Progressive Party won 63 seats in the legislative body, while Chakwera's Malawi Congress Party got 55 seats and 52 independent candidates were elected.

According to the official results, 5.1 million Malawians voted in the May 21 election, representing 74% of the registered voters, said electoral commission chairwoman Jane Ansah.

Chakwera had called for a recount in 10 of Malawi's 28 districts but the commission declined, saying that the results had been checked at several stages.

In ruling that the results should be announced, the judge said the electoral commission is mandated by law to finalize the electoral process in a timely manner. He also said there could be a judicial review of the result that the opposition leader had sought in his application.

Malawi's President Peter Mutharika casts his vote at a polling station near Blantyre, Malawi, Tuesday, May 21, 2019. More than 6 million Malawians are voting Tuesday for president, parliament and local councils in the country's sixth election since the 1994 end of dictatorship. (AP Photo/Thoko Chikondi)
Malawian President Peter Mutharika addresses his party's Democratic Progressive Party (DPP) final election rally in Blantyre, Malawi Saturday, May 18, 2019. Corruption and the need for economic growth are the main campaign issues as Malawi goes to the polls on Tuesday for a presidential election that pits the incumbent 78-year-old president Peter Mutharika of the ruling Democratic Progressive Party against his own vice president, 46-year-old Saulos Chilima as well as the main opposition party leader Lazarus Chakwera, 64. (AP Photo/Thoko Chikondi)
Malawian President, Peter Mutharika, arrives at his party's Democratic Progressive Party (DPP) final election rally in Blantyre, Malawi, Saturday, May 18, 2019. Corruption and the need for economic growth are the main campaign issues as Malawi goes to the polls on Tuesday for a presidential election that pits the incumbent 78-year-old president Peter Mutharika of the ruling Democratic Progressive Party against his own vice president, 46-year-old Saulos Chilima as well as the main opposition party leader Lazarus Chakwera, 64. (AP Photo/Thoko Chikondi)