JERUSALEM -- A U.N. aid agency that helps Palestinians in Gaza condemned the territory's Hamas rulers on Friday after discovering a tunnel running under two of its schools for boys.

Hamas has built a sophisticated network of tunnels in Gaza used for smuggling, storing weapons and for gunmen to infiltrate Israel and carry out attacks.

Israel has long accused Hamas of exploiting civilian infrastructure and of using supplies for military installations instead of civilian projects.

UNWRA said Friday it "condemns the existence of such tunnels in the strongest possible terms."

"It is unacceptable that students and staff are placed at risk in such a way," it said, adding that it "robustly intervened and protested to Hamas."

The agency said it is sealing the tunnel under its premises and will ban students and staff from the building until the issue is resolved.

The tunnel was found on June 1 under the Maghazi Elementary Boys A&B School and the Maghazi Preparatory Boys School during construction work, according to UNWRA. Both schools were empty at the time due to summer vacation.

During the 2014 war, Hamas gunmen on several occasions made their way into Israel through a tunnel, though they did not manage to reach civilian areas.

Israel destroyed 32 tunnels during that conflict, and has since made neutralizing the tunnel threat a top priority.

Gaza tunnels also stretch into neighbouring Egypt, mainly for the purpose of smuggling.

Israel and Egypt, citing security concerns, enforced a blockade on Gaza a decade ago when Hamas took over the territory from Palestinian President Mahmoud Abbas. The Islamic militant group has fought three wars with Israel since then.

Hamas spokesman Fawzi Barhoum his group "strongly condemns UNRWA's allegations." Barhoum said Hamas clarified the issue with other militant groups who denied having any "resistance-related works" in the area.