RAFAH, Gaza Strip — Dozens of high school students scrambled among the sand dunes here in recent days, learning how to shoot AK-47 rifles, crawl under barbed wire and jump over burning tires. Their bearded commanders barked at those who were too slow in hoisting iron bars overhead or those who hesitated around the thick flames.

Having seen two major Israeli military operations in Gaza in their short lives, many of the teenagers came to this boot camp, which is run by Hamas, the Islamic militant group that has led Gaza since 2007, to prepare for what they see as the inevitable next round.

“By then, I should be ready and know how to deal with the Israeli soldier’s gun when I pick it up from the ground,” said Mohammed Ghanem, 15. If the Israelis do not make another incursion into Gaza, he said, “we will go to fight them on the border.”

The six-day program, Futuwwa, enrolled about 13,000 boys at nearly a dozen sites across the Gaza Strip over the past week, with trainers from the Izzedine al-Qassam Brigades, the military wing of Hamas. It was the first time the program had taken place during a school break, and it grew out of an elective that has been offered in Gaza’s high schools since 2012 that consists mainly of lectures about weapons, street-fighting techniques, fitness and Israel’s recruitment of spies.