Afghan Deputy Interior Minister Ayoub Salangi said the two militants were killed in a shootout with heavily armed police units. Officials said at least seven members of the security forces were also killed.
The attack, which comes amid efforts to restart the stalled peace process with the Taliban and ease diplomatic tensions between India and Pakistan, resembled an assault on the Indian consulate in the northern city of Mazar-i-Sharif last week.
There has been no claim of responsibility for either attack.
Witnesses in Jalalabad, the main trade gateway to the Khyber Pass and Pakistan, said heavy gunfire and a series of explosions could be heard during the battle and residents and children from a nearby school were evacuated. There was no immediate comment from the Pakistani government.
Attaullah Khogyani, a spokesman for the provincial governor, said a suicide bomber had tried to join a queue of people seeking visas to Pakistan and blew himself up after being prevented from entering the building.
Two policemen were killed in the blast, the interior ministry said in a statement.
Last week, a group of attackers barricaded themselves in a house and resisted security forces for about 24 hours after a suicide attack on the Indian consulate in Mazar-i-Sharif.
The group responsible for that attack has not been identified but the incident fuelled suspicion in India about militants sponsored from Pakistan and it cast a shadow over the latest effort to improve relations.
Tension between India and Pakistan has risen since the attack on its consulate and on an Indian air base that killed seven Indian military personnel near their border. India has blamed the attacks on Pakistan-based militants.
A rare meeting between the foreign secretaries of both countries had been tentatively scheduled for later this week, but it is unclear if it would still happen after the attacks. A decision is not expected before Wednesday evening, Indian officials said.
Delegates from Afghanistan, Pakistan, China and the United States also met this week to try to resurrect efforts to end nearly 15 years of bloodshed in Afghanistan, even as fighting with the Taliban intensifies.
Pakistan says many Pakistani Taliban militants, who are separate from but allied with the Afghan Taliban, and are fighting to bring down the Pakistani state, have sought refuge in Afghanistan from a Pakistani army offensive.
In Pakistan on Wednesday, at least 14 people were killed in a blast near a polio vaccination center in the southwestern city of Quetta.
Banner / Thumbnail : Reuters