ISLAMABAD, Pakistan (CNN) -- Hundreds of Pakistani residents have taken up arms and are battling local Taliban militants in the wake of a deadly mosque attack last week.

A Pakistani police stands guard at a checkpoint in Peshawar, Pakistan on June 8.

It is the first major battle between the residents of northwest Pakistan and Taliban militants near the Afghanistan border.

The residents are outraged over a suicide attack on a local mosque during Friday prayers that killed at least 40 people and wounded some 80 others.

Starting on Saturday morning, some 400 villagers in the Upper Dir district formed a "lashkar" -- or militia -- to fight the Taliban, killing 14 of the militants as of Sunday evening, according to local administrator Atiq Ur Rehman. Four of the villagers have been injured in the battle, Rehman said.

The militia have burned a number of houses thought to be sheltering the militants, according to Upper Dir police chief Ijaz Kahn.

Both the residents and Taliban fighters are using heavy weapons, including rocket launchers and anti-aircraft weapons, Rehman said.

There is a long history of Taliban presence in the area, including foreign fighters in leadership roles, local officials said.

Authorities said Taliban fighters were driven out of Shot Ghas and Ghazigay -- two villages where the Taliban have support.

The villagers took up arms against the Taliban after Friday's suicide attack at a mosque in Hayagay Sharqi -- a village in Upper Dir located about 35 km (22 miles) from the Afghan border and known for being against the Taliban.

Upper Dir is a part of the Swat Valley, where the Pakistani military has waged a month-long operation against Taliban militants, but the district has not been part of the ongoing military offensive.

The United Nations has said an estimated 2 million Pakistanis have been displaced by fighting between the Pakistani military and Taliban militants.

The militants threatened to continue attacking cities in Pakistan until the military ends its operations against Taliban militants. As a result, Pakistani authorities have increased security in Islamabad, Pakistan's capital city.

CNN's Ingrid Formanek and journalist Nasir Habib contributed to this report

All About Taliban Movement of Pakistan • Swat Valley • Pakistan