Image copyright EPA Image caption The ruling party want Shahid Khaqan Abbasi to serve until Nawaz Sharif's brother can take over

Lawmakers in Pakistan have elected Shahid Khaqan Abbasi as prime minister, replacing Nawaz Sharif, who was ousted last week over corruption allegations.

The ruling party wants the former oil minister to hold the role temporarily until Mr Sharif's brother, Shahbaz Sharif, can take over.

Shahbaz Sharif, Punjab province's chief minister, must win a parliamentary by-election to be eligible for PM.

Mr Abbasi was elected with 221 votes from the 342-member National Assembly.

He thanked Nawaz Sharif after the vote, saying "the process of democracy is back on track" and rejecting claims he would only serve as a placeholder for Shahbaz Sharif.

"They say, 'Oh, he's only here for 45 days.' I say, I may be here for 45 days or 45 hours, but I'm not here to keep the seat warm," he said.

"I intend to work and get some important things done if the cabinet supports me in this."

Opposition groups had also nominated candidates but the ruling Pakistan Muslim League-Nawaz (PML-N) party holds a majority and was easily able to get their candidate through.

Lawmakers from the party chanted the name of Nawaz Sharif after the vote.

PML-N lawmaker Rana Muhammad Afzal Khan earlier told Reuters news agency the prime objective was "to give Pakistan stability".

"As a responsible party we have to take Pakistan ahead," he said.

Shahbaz Sharif is to contest the parliamentary seat left vacant by his ousted brother but that process is expected to take at least 45 days.

Mr Abbasi went to university in the US, and worked there and in Saudi Arabia as an engineer before entering Pakistani politics.

He is a long-time ally of Nawaz Sharif, who has been prime minister three times.

Mr Sharif's third spell in the job came to an end on Friday when he stepped down following a decision by the Supreme Court to disqualify him from office.

Analysis: Who is Pakistan's new PM?

M Ilyas Khan, BBC News, Islamabad

Shahid Khaqan Abbasi sailed through parliament with a majority vote and has been sworn in by the president.

The choice of Mr Abbasi appears to have been triggered by two factors - he is the least controversial among the PML-N ranks, and has links with the military establishment. His father was a Pakistan Air Force officer, who later entered politics and served as a federal minister during the military regime of Gen Ziaul Haq in the 1980s, before being killed in the 1988 Ojhri Camp disaster.

Mr Abbasi has won a parliamentary seat from his native Murri area of Rawalpindi district six times. He hast lost only once, in 2002.

He was the aviation minister in 1999 when Nawaz Sharif's government was toppled by the military, and was jailed for two years after the coup. Most recently, he was minister of petroleum and natural resources in the outgoing cabinet.

Since his likely successor, Shahbaz Sharif, also favours peace with Pakistan's powerful military establishment, PML-N doves appear to have been brought to the fore to lead the government for the remainder of a term that ends in mid-2018.

The ruling came after an investigation into his family's wealth following the leak of the Panama Papers in 2016, which linked Mr Sharif's children to offshore companies and assets not shown on his family's wealth statement.

The court said Mr Sharif had been dishonest in not disclosing his earnings from a Dubai-based company in his nomination papers during the 2013 general election.

Image copyright Reuters Image caption Shahbaz Sharif must be elected to parliament before he can take over

It recommended anti-corruption cases against several individuals, including Mr Sharif, his daughter Maryam and her husband Safdar, Finance Minister Ishaq Dar and others.

Allegations of corruption have dogged Mr Sharif since the 1980s, but he denies any wrongdoing.