Up to 1,000 prisoners, including 400 Taliban militants, were on the run in Kandahar last night after a dramatic Taliban assault on the southern Afghan city's main prison.

The militants blew the prison gates open with a massive truck bomb and flooded inside, attacking the guards and freeing the inmates. A jubilant Taliban spokesman said the group had deployed 30 motorcycle mounted attackers and two suicide bombers.

Ahmed Wali Karzai, brother of the president Hamid Karzai and head of Kandahar's provincial council, said that "all" the prisoners had escaped.

Authorities in Kandahar declared a state of emergency as police and soldiers swarmed across the city in an attempt to round up the fugitives.

The Taliban said the attack on the prison, the biggest in southern Afghanistan, had been in preparation for two months. "Today we succeeded," Qari Yousaf Ahmadi told the Associated Press, adding that the escapees were "are safe in town and they are going to their homes".

The first explosions were heard at 9.30pm local time when insurgents rammed a tanker truck filled with explosives into the front gate of Sarposa prison, killing several guards, said director Abdul Qadir. "All of the guards at the gate have been killed and they are under the rubble," he told Reuters a few hours later. Gunfire could be heard in the background as he spoke.

Moments later the militants launched a multi-pronged assault on the facility. Qadir said a suicide bomber blasted a hole in the rear wall. There were also reports of rocket-propelled grenades hitting the perimeter from several directions.

Several Taliban fighters entered the prison, sparking gunfights with guards. Several militants were reportedly killed.

Accounts differed about exactly how many prisoners escaped under cover of darkness but all agreed that the jailbreak was substantial.

Reuters quoted unnamed local officials who said nearly all of the 1,150 prisoners fled, including 400 Taliban fighters. The prison director could not say how many guards had been killed or injured.

Local traders reported seeing prisoners fleeing into nearby pomegranate orchards. Ahmed Wali Karzai said the orchards offered good cover. The escapees included many "important" Taliban including several intended suicide bombers who were captured before they could detonate their vests, he said.

Hours later, several rockets slammed into a base used by foreign troops elsewhere in Kandahar, triggering the sound of sirens from inside the base.

No further details were immediately available. Officials with Nato's International Security Assistance Force said they were aware of the attack but couldn't immediately provide any details.

Last month about 50 prisoners went on hunger strike at Sarposa, sewing their mouths shut in protest. Conditions are extremely poor in Afghan jails with prisoners often held for months or years without their case being heard in court.

The hunger strikers ended the weeklong protest after a parliamentary delegation promised their cases would be reviewed.

The US military has captured hundreds of people since its forces helped to topple the Taliban regime in late 2001.

It handed some Taliban prisoners to the Afghan authorities last year as part of a programme to transfer detainees into Afghan custody.

Kandahar city was the headquarters of the Taliban's five-year rule in Afghanistan from 1996 to 2001. After being initially written off as a spent force by Nato and Afghan commanders, the militants have staged a resurgence in recent years.

The renewed insurgency is concentrated in the south and east of the country. Kandahar, where mostly Canadian troops are stationed, and Helmand, where more than 7,000 British soldiers are deployed, have borne the brunt of the recent fighting.

The militants have been strengthened partly by the failures of western military tactics and reconstruction in Afghanistan, and partly thanks to their rear bases in neighbouring Pakistan.

Tensions along the border area are increasingly. This week the Pakistani military accused the US of bombing one of its border positions, killing 11 Pakistani soldiers.

The jailbreak will further dent international confidence in the Karzai government, which suffers rampant corruption, much of it related to the drug trade.

On Thursday in Paris international donors pledged another $20bn for Afghan reconstruction over the next five years.