At least four Afghan security personnel were killed in the fighting, with 13 more injured.
A separate suicide blast took place in the north of Kabul, killing another 10 people.
Dhabihullah Mujahid, a spokesman for the Taliban, told Al Jazeera by telephone that the group was behind the Kabul assaults.
Witnesses said the attackers opened fire indiscriminately in front of the justice ministry headquarters.
Officials said five men stormed the building equipped with AK-47s, grenades and wearing suicide vests.
At least two suicide bombers separately attacked the prison affairs department in the same complex.
Security forces said they prevented another possible raid by shooting a suicide attacker next to the buildings of the foreign-affairs and education ministries.
Elsewhere in Afghanistan, a French military officer and an Afghan interpreter were killed, and a French soldier seriously wounded, in a gun battle following a landmine blast on Wednesday.
The men were on security patrol in Logar province when the explosion occurred, a French military spokesman said.
No one has yet claimed responsibility for the attack.
Describing the co-ordinated attacks in Kabul, Qais Azimy, Al Jazeera's correspondent in Kabul, said: "It is a success for them [the Taliban] ... It shows that they are still powerful."
Azimy said that the attacks so close to the presidential palace showed that the Taliban can still hit any location.
"Over a year ago that kind of attack could be a surprise, but not any more," he said.
|The attacks came shortly before a visit to Kabul by US special envoy Holbrooke [AFP]
Speaking to Al Jazeera, Faheem Dashty, chief editor of the Kabul Weekly
, said: "The Taliban is choosing a new kind of tactic, which is a chain of attacks on the same day.
"This was a lapse in the security belt around Kabul. We have security on main roads entering Kabul but in other areas we don't have enough [measures] to stop people carrying out an attack [of the kind] that happened today."
Al Jazeera's Hamish Macdonald, also in Kabul, said that the justice ministry and prisons department appeared to have been deliberately targeted by the Taliban, in response to the alleged mistreatment of Taliban prisoners.
The Taliban, which once ruled Afghanistan, was driven out of Kabul following a US-led invasion in late 2001.
However, Taliban fighters have since regrouped, launching attacks in Pakistan and Afghanistan from bases in the region between the two countries.