A man convicted of killing eight children has been executed at a Pakistani prison after the country’s top court rejected a request for his public hanging.

Mohammad Imran was hanged in the eastern city of Lahore in the presence of the father of seven-year-old Zainab Ansari, whose rape and murder in January ignited nationwide outrage.

Imran was arrested two weeks after he threw her body into a rubbish dump in the city of Kasur in Punjab province.

Zainab Ansari's family
The family of Zainab Ansari (AP)

After his arrest, Imran confessed to the other killings and was convicted in court. Other courts later upheld his death sentence.

Police official Mohammad Afzal said: “Imran was taken to the gallows just before dawn and he has been hanged with a rope in the presence of magistrate and a doctor.”

Zainab’s father, Mohammed Amin Ansari, was allowed to witness the execution.

Mr Ansari had demanded that Imran should be hanged at some public place in order to deter others, but the judges rejected his plea this week.

A press conference announcing the suspect
Imran was executed over the murder of eight children (AP)

Shortly after witnessing Imran’s execution, Mr Ansari thanked the judiciary, government and investigators for delivering speedy justice.

“My daughter will not come back, but I am satisfied that we got justice,” he said.

Authorities handed over the body of Imran to his family and he was expected to be buried later on Wednesday.

Zainab’s rape and murder shocked the nation after a photo of her went viral on social media, showing the smiling girl in her favourite bright pink coat, with a pink barrette in her hair.

Pakistanis rallied across the country, demanding the immediate arrest of the killer.

Mr Ansari was on a pilgrimage in Saudi Arabia with his wife at the time of his daughter’s disappearance.

His daughter disappeared while going to a nearby home for Quranic studies.