In a rare visit by the leader of a Muslim country , Turkey 's prime minister , Recep Tayyip Erdogan , came to Israel on Sunday offering to serve as a Middle East peace mediator and looking to build on trade and military ties .