Seeking to secure Sinai, Egypt builds closer ties with Hamas