But the police immediately re-arrested one suspect whom the United States has expressed interest in questioning.
Nairobi High Court justice John Osiemo on Thursday said prosecutors had not proven the four were involved in the 28 November, 2002 bombing of the Mombasa Paradise Hotel in which 18 people, including three Israeli tourists, 12 Kenyans and three car bombers, were killed.
"Since ... the suicide bombers ... perished during the attack, there is no evidence whatsoever to connect the accused to the murder of the deceased persons," Osiemo said in his 11-page written ruling.
"There is no evidence that any of the accused had known those suicide bombers before nor is there any evidence that they had met and pre-arranged a plan to prosecute any common unlawful purpose," he said.
"I make a finding of not guilty ... and acquit them," Osiemo said.
The four accused, Aboud Rogo Mohammed, an Islamic preacher, Mohammed Kubwa, a local politician, Omar Said Omar, a computer expert, and Mohammed Ali Saleh Nabhan, a merchant, had all pleaded not guilty in the case.
One of the four suspects was
re-arrested after the court ruling
Each had each faced 15 counts of murder and could have received the death penalty if convicted. The shouted "Allahu Akbar" ("God is Great") on hearing the verdict.
"We knew Allah would not forsake us," Rogo Mohammed said afterward. "He has made justice prevail."
However, Omar was re-arrested by police shortly after the verdict was announced and his lawyer said he had been told his client would be charged on Friday with illegal weapons possession.
Omar was the only one of the four who police claim confessed to involvement in terrorism and earlier this year his attorney Winston Ngaira said the United States wanted to extradite him, possibly to testify against terrorism suspects.
US officials have declined to comment on the matter but are thought to be interested in Omar for questioning about the August 1998 bombings of the US embassies in Nairobi and Dar es Salaam and other terrorist acts.
Osama bin Laden's al-Qaeda network claimed responsibility for the embassy bombings as well as the hotel attack and a failed attempt the same day to shoot down an Israeli airliner taking off from Mombasa airport.