Egypt 's President Hosni Mubarak says the militant Islamic group Hamas must recognize Israel if it wants to form a Palestinian government .