Media playback is unsupported on your device Media caption A shoe was thrown at Mr Musharraf during chaotic scenes

A court in Pakistan has extended bail for former President Pervez Musharraf, amid chaotic scenes in which a shoe was thrown at him.

It is the first time the ex-military ruler has sat before a court to defend himself against charges of conspiracy to murder and the sacking of judges.

The shoe, which did not hit Mr Musharraf, was thrown as his supporters and opponents both chanted slogans.

Last week he returned from self-imposed exile to contest forthcoming polls.

Shortly before his return he was granted protective bail for 10 days in three cases.

Correspondents say that angry scenes were witnessed outside the courtroom in Karachi after judges extended bail for another few weeks.

Mr Musharraf faces a string of charges dating from his final months in office.

Pervez Musharraf Born on 11 August 1943, Delhi, India

Married with two children

Joined Pakistan Military Academy in 1961

Saw action in the 1965 war against India

Attended Royal College of Defence Studies in the UK

Frequently promoted, was made a general in 1998

Has been in self-imposed exile - mostly in the UK - since 2008

Since then is estimated to have earned thousands of dollars on worldwide lecture tours Profile: Pervez Musharraf

He is accused of failing to provide adequate security for former PM Benazir Bhutto ahead of her assassination in 2007.

He is also wanted in connection with the murder of a Baloch tribal leader, Nawab Akbar Bugti and for sacking the entire higher judiciary in November 2007.

The former president has described the cases against him as "baseless" and politically motivated.

He led a military government which ruled Pakistan from 1999.

His supporters were defeated in parliamentary elections in February 2008, and Mr Musharraf resigned in August that year under threat of impeachment. He has lived in London and Dubai since then.

He has vowed to return several times in the past, but those previous attempts were abandoned. He finally returned last weekend despite threats against him by the Taliban and the outstanding cases against him.