JERUSALEM — Israel’s intense 18-day search for three abducted teenagers ended Monday when their bodies were found buried under a pile of rocks in an open field about 15 miles from where the youths were last seen in the occupied West Bank.

A nation that had been enmeshed in hopeful prayer was instantly engulfed by a mix of grief and anger and vowed retaliation against the militant Palestinian group Hamas, which Israel says was behind the killings.

“They were kidnapped and murdered in cold blood by beasts,” Prime Minister Benjamin Netanyahu of Israel said at the start of an emergency cabinet meeting Monday night. “Hamas is responsible, and Hamas will pay.”

Just after midnight, witnesses in Hebron, the West Bank’s largest city, said the retaliation had begun as Israeli forces used explosives to demolish the homes of Marwan Qawasmeh and Amer Abu Aisha, the Hamas men who have been missing since the teenagers vanished and who are Israel’s prime suspects.