Updated

Taliban militants killed 20 people in a coordinated attack on three government buildings in Kabul, launching the assault after sending text messages to the leader of their terror cell in Pakistan, the head of Afghan intelligence said.

The three-pronged attack on government ministries struck the heart of the heavily fortified Afghan capital on the eve of a visit by Richard Holbrooke, President Obama's special envoy to the region. It underscored the reach of the Taliban outside their mountainous strongholds and the challenges Obama faces as he increases America's focus — and troop levels — in Afghanistan.

The morning assault sent workers scrambling for safety as security forces spread out in the

Click here for photos.

streets and searched rooftops for attackers, reinforcing the perception that security in Afghanistan is rapidly deteriorating. Security analysts tracking daily attacks say numbers have spiked this year, and militants now control wide swaths of Afghan countryside.

The assault began about 10 a.m. and was carried out by eight insurgents carrying Kalishnikov rifles, grenades and explosive vests. The Taliban claimed responsibility shortly after the siege began.

All eight attackers died, said Mohammad Hanif Atmar, the interior minister, bringing the death toll to 28. Another 57 people were wounded, he said.

The tactics the militants employed were similar to the Mumbai assault on hotels, markets and a train station last November that killed 164 in India, said Amrullah Saleh, the head of Afghanistan's intelligence service.

Indian officials have blamed the Mumbai attack on the Pakistani-based militant group Lashkar-e-Taiba. Saleh did not blame Pakistan, but said the attackers communicated with a militant leader in Pakistan.

"As they were entering the Ministry of Justice and before starting the indiscriminate killing of the civilians there, they sent three messages to Pakistan, calling for the blessing of their mastermind," Saleh told a news conference.

In Pakistan, Foreign Ministry spokesman, Abdul Basit, said he had not seen Saleh's comments and could not comment. The army spokesman did not answer a telephone call late Wednesday.

Afghanistan has accused militants based in Pakistan's lawless tribal areas or Pakistan's spy service for being behind several major attacks in Kabul, including the bombing of the Indian Embassy last July, an assassination attempt against President Hamid Karzai in April and an assault on the luxury Serena Hotel in January 2008.

By focusing the blame on militants in Pakistan, Saleh reinforced recent remarks by Obama, who has warned that militants using Pakistani territory to launch attacks should not be allowed free reign.

Five armed men with assault rifles, grenades, a bag full of plastic explosives and ball bearings stormed the Justice Ministry around 10 a.m., shooting at workers and briefly trapping the minister inside.

As they moved into the building they killed two guards. For the next three hours they holed up inside the ministry, firing 200 bullets and killing a total of 13 people before Afghan security forces stormed the building and killed the attackers, Saleh said.

Justice Minister Sarwar Danesh spoke to AP while he was briefly trapped inside the ministry with a number of government employees.

"They used grenades and AK-47s," Danesh said of the attackers, speaking by mobile phone.

Ministry workers jumped out of a second-floor windows to escape the advancing gunmen.

"I came out of my office to see what was going on, and I saw a man with an AK-47 shooting at every employee he saw in the hall," said ministry employee Nazir Mohammad, who shook as he spoke.

At nearly the same time, about a half mile (1 kilometer) away, another assailant in a suicide vest was shot as he tried to force his way into the Education Ministry.

Meanwhile, across town, two men in suicide vests tried to storm the Justice Ministry's correction department.

Guards shot and killed one attacker, but the second entered the building and blew himself up, killing six policemen and wounding 29 others, Interior Minister Hanif Atmar said.

According to the account 19 people, not including the attackers, were killed in the assault although officials set the number at 20. Twenty-one suspects were detained.

Karzai lauded his security forces and said they have "the ability to defend their people ... and today's operation was a good example of their ability."

Taliban spokesman Zabiullah Mujaheed said the attacks were in response to what he claimed was the mistreatment of Taliban prisoners in Afghan government jails.

"We have warned the Afghan government to stop torturing our prisoners," Mujaheed told AP in a phone call from an undisclosed location.

Mujaheed and the Taliban's Web site claimed that more than 100 security officials and government employees were killed and 150 others wounded. The Taliban habitually exaggerates the impact of its attacks.

According to the U.S.-based SITE Intelligence Group, which monitors militant Web sites, the Taliban later posted information on the site saying 16 "martyrdom-seekers" were deployed to Kabul on the order of Mullah Muhammad Omar, a Taliban leader who was driven from power in Afghanistan in the 2001 American-led invasion. He is widely believed to be in hiding in Pakistan.

The posting said eight of those dispatched returned to their positions safely.

Saleh said that Afghan officials had information indicating a "spectacular" attack involving multiple suicide bombers was imminent, but he said officials did not have enough specifics to prevent it.

"We have to be successful round the clock, seven days a week, 365 days a year, and they have to be successful only once. That is the difference," Saleh said.

He promised more details on the attackers and their mastermind would be released.

The incident comes as Holbrooke makes his first visit to Afghanistan as Obama's envoy. The new president's administration has vowed to increase U.S. focus on the resurgent Taliban, including sending up to 30,000 more troops here. Holbrooke is helping the administration chart a new strategy to beat insurgencies in both Afghanistan and Pakistan.

The Taliban regularly use suicide bombings in their assaults on Afghan and foreign troops, but attackers have rarely made it inside the barricaded and guarded compounds of government buildings in the capital.