Up to 30 Taliban-linked fighters, including suicide bombers, have attacked two Nato bases in Afghanistan's east.
At least 21 fighters were killed and four Nato soldiers wounded in the pre-dawn attacks on Saturday, officials told Al Jazeera.
The fighters launched the first attack on the Forward Operating Base Salerno in Khost province near the southeastern border with Pakistan before moving on to occupy the nearby Camp Chapman.
The heavily fortified Chapman base is the site of an attack last December in which seven CIA officers were killed by a suicide bomber, the second-most deadly attack in CIA history.
"About 28 to 30 fighters belonging to the Haqqani network, which is a group closely affiliated to the Taliban, tried to carry out the attack," Al Jazeera's Hoda Abdel-Hamid, reporting from the capital, Kabul, said.
"At about 4am the fighters launched co-ordinated attacks on the two bases in the Khost province," she said.
"What followed was a standoff that lasted way into the early morning."
Lieutenant Commander Katie Kendrick, a Nato spokeswoman, confirmed the attacks.
"Afghan National Security Forces and International Security Assistance Force soldiers repelled two attacks at bases in Khost province today," Nato said in a statement.
"While the majority of the attacking fighters were killed outside of the [bases], two insurgents managed to breach the perimeter and made it onto ... Salerno. Coalition forces had the two insurgents under surveillance and when they cut the fence, a quick reaction force was dispatched to the location where they were killed immediately."
The Haqqani network is responsible for some of Afghanistan's highest-profile attacks, including a January 2008 attack on the Serena Hotel in Kabul - a favorite expat haunt - and an April 2008 assassination attempt against Afghan president Hamid Karzai. US and Nato commanders have called Haqqani their greatest strategic threat in Afghanistan.
Despite the presence of almost 150,000 foreign troops, violence across Afghanistan is at its worst since the Taliban were ousted by US-backed Afghan forces in late 2001.
More than 2,000 foreign troops have been killed, most of them Americans, since the conflict began.
Hundreds of civilians have also been caught in the crossfire, with civilian deaths spiking by 31 per cent in the first six months of this year, according to a United Nations report.
Meanwhile on Saturday, the Nato-led International Security Assistance Force said its forces had mistakenly killed two private security contractors after one of its patrols came under fire from fighters in Wardak province, west of the capital, Kabul.
A car approached the patrol on a highway in the Maidan Shahr district of Wardak on Friday and men could be seen shooting out of the vehicle's windows, Isaf said in a statement.
The patrol fired on the vehicle, killing two people inside later identified as private security contractors.
"It is believed that the private security contractors were returning fire against the same insurgents who had just previously attacked the coalition vehicle, and had increased their speed to break contact," Isaf said.
Poor security is one of the main concerns for Afghans before parliamentary elections on September 18, a milestone after fraud-marred presidential polls last year and with Barack Obama, the US president, planning a strategy review in December.