Governor Issa Timamy of Lamu county was arrested last week in connection with the killings earlier this month in the town of Mpeketoni and nearby villages.
High Court Judge Martin Muya ruled there were "no grounds to continue detaining him in custody," and released Timamy on bail of five million Kenyan shillings (57,000 dollars, 42,000 euros).
Prosecution lawyer Alexander Muteti said the governor was "being investigated for the offence of murder, forcible transfer of populations and terrorism related offences".
The accusations have stoked already tense political rivalry between Kenyatta and opposition parties.
Timamy is a member of the opposition United Democratic Forum (UDF) party.
He is due to appear again in court in the main port of Mombasa on July 16.
Survivors of the attack in Mpeketoni reported gunmen speaking Somali and carrying Shebab flags, executing non-Muslims and saying their actions were revenge for Kenya's military presence in Somalia as part of the African Union force fighting the Islamists.
Police have also arrested alleged separatists from the Mombasa Republican Council (MRC), a group that campaigns for independence of the coastal region.
The attacks have badly dented Kenya's tourist industry at one of its traditionally busiest times of the year, a key foreign currency earner and massive employer for the country.
