(CNN) -- U.S. President Barack Obama said Thursday that Hamas, which governs Gaza, "has the responsibility to prevent" violations of a cease-fire with Israel, such as the firing of two rockets Thursday morning from Gaza into southern Israel. The cease-fire, he said, protects both Israelis and Palestinians. "It would be easy for (Israel) to say, 'You see this is why we can't have peace, because we cant afford to have kids sleeping in their beds and suddenly a rocket comes through the roof,' " he said at a news conference with Palestinian President Mahmoud Abbas.