Foreign and Afghan troops killed 24 insurgents as they fought off pre-dawn attacks on two bases in eastern Afghanistan on Saturday, officials said, with the Taliban saying suicide bombers the fighters.

The attacks targeted the U.S. military's Forward Operating Base Chapman and nearby Forward Operating Base Salerno in Khost province near the eastern border with Pakistan, where U.S. and other foreign forces have been stepping up operations against a resurgent Taliban.

Seven Central Intelligence Agency officers were killed by a suicide bomber inside Chapman last December, the second-most deadly attack in CIA history.

Despite the presence of almost 150,000 foreign troops, violence across Afghanistan is at its worst since the Taliban were ousted by U.S.-backed Afghan forces in late 2001.

Taliban-led insurgents have launched increasingly brazen attacks around Afghanistan in a bid to topple the government and force out foreign troops. 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 up by 31 percent in the first six months of this year, according to a United Nations report.

The NATO-led International Security Assistance Force (ISAF) said air support was called in after the bases came under attack by small-arms fire, rockets and rocket-propelled grenades at about 4 a.m. (2330 GMT Friday).

Similar attacks against foreign military bases and Afghan government buildings in the east have been made in the past year.

ISAF said in a statement later on Saturday that about 15 insurgents were killed at Salerno and another six at Chapman. Two insurgents were able to breach the perimeter into Salerno but were killed immediately, it said.

Also, an insurgent from the al Qaeda-linked Haqqani network and two other fighters were killed in an air strike called in when they were seen driving away from the attack, taking the total killed to 24.

Five insurgents were captured and a car bomb and another vehicle carrying ammunition were found near the camps, ISAF said. It said four ISAF soldiers were wounded.

Zabihullah Mujahid, a spokesman for the Taliban, said about 30 fighters had attacked the bases. They included suicide bombers and others armed with rockets and machine guns, Mujahid told Reuters by telephone from an undisclosed location.

Khost police chief Abdul Hakim Ishaaqzai said the bodies of 24 insurgents were found near the two bases. Reuters Television pictures showed some were wearing Afghan police or army uniforms.

Ishaaqzai said two civilians were also killed. Though ISAF said the attacks had been repelled, residents said intermittent shooting and explosions could still be heard several hours later.

CONTRACTORS KILLED

ISAF also said its forces had mistakenly killed two private security contractors after a patrol came under fire from insurgents in an attack in Wardak province, west of the capital.

A car approached the patrol at speed 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.

Also on Saturday, 48 Afghan schoolgirls were taken to hospital after a suspected poison gas attack on their school in the capital, Kabul, the Ministry of Public Health said, the second such attack in the past three days.

Thirty-nine were released after treatment, while nine were kept for observation or further treatment.

The Taliban banned education for girls when they ruled Afghanistan from 1996-2001 but have condemned similar attacks in the past. They have, however, set fire to dozens of schools, threatened teachers and attacked schoolgirls in rural areas.

The suicide attack on Forward Operating Base Chapman on December 30 last year highlighted the insurgency's reach and coordination, particularly in their strongholds in the south and east.

A similar attack was launched this month on the main foreign base in southern Kandahar, the spiritual homeland of the Taliban.

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 U.S. President Barack Obama planning a strategy review in December.

(Additional reporting by Hamid Shalizi in Kabul; Editing by Paul Tait and Jon Hemming)