JERUSALEM — Thirty-seven young war orphans from Gaza set out on Sunday for a rare visit to Israel. They got as far as the Erez border crossing at the northern end of the Palestinian coastal enclave. There the Hamas authorities turned them back, barring the visit at the last minute.

Israeli officials and organizers of the highly unusual weeklong peace-building visit said that it had been fully coordinated with the Israeli liaison authorities and that Israeli approval had been given. But Hamas, the Islamic militant group that dominates Gaza, apparently went back on an initial agreement to allow the youths to enter Israel.

“This was a suspicious visit that aimed to normalize our children with the Zionist occupation,” Eyad al-Buzom, a spokesman for the Interior Ministry in Gaza, said in a telephone interview. “In order to protect our sons, we prevented them from visiting the occupation,” he said, referring to Israel. Mr. Buzom refused to elaborate, but he said that all “dangerous” trips of this kind would be prevented in the future.

The youths, ages 13 to 16, according to Mr. Buzom, were to be accompanied by five adults from Gaza.

Hamas refuses to recognize Israel’s right to exist and is sworn to its destruction. Israel, like much of the West, considers Hamas to be a terrorist organization and refuses direct dealings with it.