Pakistan's election officials have banned Pervez Musharraf from standing in next month's general elections, dealing a fatal blow to the former military dictator's hopes of re-entering public life in the country.

The ex-president was disqualified from running in four separate constituencies after failing to meet constitutional requirements to protect the independence of the country's judiciary.

Election officials have also disqualified Raja Pervaiz Ashraf, the man who until just a few weeks ago was the country's prime minister, under articles ensuring candidates are, among many other things, "sagacious, righteous and non-profligate".

The rulings highlight the muscle and assertiveness of Pakistan's election officials as the country heads towards historic polls on 11 May.

And they are a personal disaster for Musharraf, whose decision to return to Pakistan last month after four years of staying abroad, beyond the reach of the country's courts, increasingly looks like an extraordinarily ill-advised mistake.

The former general, who seized power in a coup in 1999, had hyped his return saying he would "save" Pakistan and sweep back to power. However, he was met by a feeble-sized crowd of supporters when he travelled by commercial flight from his home in exile in Dubai to Karachi. He remained holed up in a luxury hotel in the Pakistani port city for a few days, only venturing out with a heavy personal security detail.

The risk to Musharraf's life had been highlighted earlier when the Taliban released an elaborate video claiming a specialist hit team of suicide bombers had been gathered with the express aim of assassinating the former general.

Although he was granted bail before even returning to Pakistan, Musharraf is banned from leaving the country.

In another misstep that appeared unlikely to win him much-needed support in a country where US drone strikes are detested, he admitted for the first time in an interview that he had struck a secret deal with the CIA, giving the US spy agency permission to use the unmanned aircraft in Pakistani skies.

"It is just very unfortunate that he didn't foresee the problems he was going to face, or take the advice of his well-wishers who warned him to stay away from Pakistan," said Talat Masood, a retired general who knows Musharraf well.

"But he was misguided and living under his own delusion that he still had a political future in Pakistan."

Pakistan's top politicians try to improve their chances by contesting multiple seats. But Musharraf was ruled ineligible for four separate constituencies.

He was ruled out on the basis of the sweeping and controversial articles 62 and 63 of Pakistan's constitution, which can ban candidates for low moral standing, insufficient knowledge of Islam and even for disrespecting an amorphous concept known as "the ideology of Pakistan".

Musharraf's standing in the eyes of returning officers was weakened by the extremely serious cases against him. He is accused of being involved in the assassination of the former prime minister Benazir Bhutto and the killing of a tribal rebel from the southern province of Baluchistan called Akbar Bugti.

But perhaps most fatal to his cause was the sacking of all of the country's top judges as his hold on power weakened in 2007.

Although his nomination had originally been accepted for Chitral, a mountainous constituency where Musharraf is credited for building a tunnel and other bits of important local infrastructure, it was rejected on Tuesday.

Officials objected to discrepancies between Musharraf's signature on different parts of his nomination paper and also because it was submitted by someone who was not authorised to do so.

Musharraf vowed to take his case to appeal.

"The selection bias and unwarranted activism shown by the election tribunal in rejecting my nomination papers from all four constituencies is not going to deter my resolve to help save Pakistan," a statement issued by Musharraf's All Pakistan Muslim League said.

The former prime minister Ashraf has also been ruled ineligible by an election tribunal. The politician, who served as premier in the dying months of the last government, was rejected on various grounds, including his alleged involvement in a scandal involving contracts awarded to private power companies.

Several candidates have, however, successfully appealed against some rulings by election officials which have been attacked by some critics as overzealous enforcement of constitutional articles originally brought in by Muhammad Zia-ul-Haq, one of the country's former dictators, and which had been largely ignored until recently.