The number of attacks on schools in Afghanistan nearly tripled last year, UNICEF said Tuesday, cutting children's access to education amid worsening security in the war-torn nation.

Attacks on Afghan schools increased from 68 in 2017 to 192 in 2018, the first increase in such incidents since 2015.

Afghanistan's ongoing war, now in its 18th year, resulted in more than 1,000 schools being closed by the end 2018, UNICEF said, depriving some 500,000 children of their right to learning.

"Education is under fire in Afghanistan," UNICEF Executive Director Henrietta Fore said in a statement.

"The senseless attacks on schools; the killing, injury and abduction of teachers; and the threats against education are destroying the hopes and dreams of an entire generation of children."

Using schools as voter registration centres for parliamentary elections last year was one factor in the increase in attacks, UNICEF said.

About 3.7 million school children between the ages of seven and 17 -- accounting for almost half of all school-aged children in Afghanistan -- do not attending school, according to the UN agency.

It blamed insecurity, poverty and discrimination against girls -- who make up about 60 percent of children not in education.

The Taliban opposed education for girls when they ruled Afghanistan from 1996 to 2001.

After the Islamist extremists were toppled in a US-led invasion, millions of girls began to receive an education.

But schools, students and teachers have been coming under increasing fire.

Last month, gunmen blew up a girls' school in western Farah province. The incident followed the killing of a school teacher in northern Faryab province earlier this month.

According to the United Nations, 3,804 civilians -- including more than 900 children-- were killed in Afghanistan in 2018, with another 7,189 wounded.

It was the deadliest year to date for civilians in Afghanistan's conflict.