Afghan security forces managed to fend off the attackers, who then moved into a nearby building, firing rockets and AK-47 machine guns. All six attackers were killed in the ensuing firefight, Karimi said.
Inside the parliament building, lawmakers were gathered in a meeting hall when the first explosion struck, Arif Rahmani, a member of parliament, told CNN.
The blast shattered glass and shook loose a thin layer of the ceiling that filled the hall with a cloud of dust, he said.
The members of parliament had assembled for a general meeting at which Mohammad Masoom Stanikzai, the government`s nominee for defense minister, was to be introduced in order to present his plans and policies ahead of a confidence vote.
All the lawmakers were evacuated from the parliament building unharmed, Karimi said.
But at least 31 civilians were wounded in the attack, including three children, said Dr. Kabir Amiri, head of Kabul Central Hospitals.
Taliban spokesman Zabiullah Mujahid said on his Twitter account that the militant group chose to target the parliament on the day the defense minister was to be introduced to lawmakers.
The U.N. mission in Afghanistan condemned the attack, calling it "a clear and deliberate affront to democracy in Afghanistan."
The U.S. Embassy issued a statement saying the assault showed "blatant disrespect for democracy and the rule of law."
Monday`s assault is the latest in a string of high-profile attacks by insurgents in the Afghan capital.
Recent targets have included hotels housing foreigners, like the Park Palace Guest House, where more than a dozen people were killed last month.
More broadly, Afghan forces are grappling with a Taliban offensive across different parts of the country. American-led international troops pulled out of Afghanistan last year.
Stanikzai, the defense minister nominee, is the former chief executive of the Joint Secretariat of the Afghanistan High Peace Council, an organization tasked with pursuing peace talks with the Taliban and other insurgent groups in the country.
The introductions of nominees for Cabinet minister positions, particularly the defense minister, were held up for months by squabbling between the two leading Afghan presidential candidates, Ashraf Ghani and Abdullah Abdullah.
A deal was eventually reached under which Ghani became President and Abdullah got the newly created position of chief executive.