Pakistan's Interior Ministry says gunmen have released all the children briefly held hostage at a high school in North West Frontier Province.
Ministry spokesman Javed Cheema says the gunmen surrendered to the local jirga (tribal council) along with their weapons and released the children. The ministry said up to 250 students were being held.
The gunmen took refuge in the school after an aborted attempt to abduct a health official in a neighboring district. The official was eventually freed after clashes with police. Police then surrounded the building while tribesmen negotiated with the insurgents.
Officials say the kidnappers had demanded safe passage in return for freeing the students.
Violence has spread in recent months in areas of Pakistan near the border with Afghanistan, which are believed to be sanctuaries for al Qaeda and Taliban militants.
Some information for this report was provided by AFP and Reuters.