Ugandan police are holding in custody a man suspected to have unsuccessfully plotted a bomb attack in Kampala. / Photo: Reuters

Uganda police have said that they foiled a bomb attack on a cathedral in Kampala and detained a man accused of trying to detonate an explosive in a crowd of worshippers.

Hundreds of congregants were evacuated from the Rubaga Miracle Centre Cathedral in the capital city on Sunday after a man tried to enter the grounds carrying an explosive, police spokesperson Patrick Onyango said.

"We have carried out a controlled detonation of the improvised explosive device which was made of nails, a motorcycle battery, a charger and a telephone handset which was to be used in the attack," he told reporter s outside the cathedral on Sunday.

He said police trailed the man after receiving a tip off about a possible attack on a house of worship, and discovered the bomb inside his backpack when he was stopped and searched.

He said police were pursuing three other men after the suspect, 28-year-old Ibrahim Kintu, revealed that he may have had accomplices.

‘Jesus loves us’

The cathedral was cordoned off and sniffer dogs and bomb squad officers sent to comb the expansive grounds, but no further threat was found.

Its high-profile pastor, Robert Kayanja, told AFP that “the lord has saved us from deaths.”

"The terrorist was a few yards to the entrance of the church, but the security put up resistance and (he) was arrested before he could enter the church and detonate the bomb," the high-profile evangelist, who is a public ally of Uganda's long-serving leader, Yoweri Museveni, said.

"Go out to the world and tell them we have just survived a bomb, but Jesus loves us!" Kayanja later told worshippers after prayer services resumed a few hours later.

Attack alert

Police had been warned of a possible attack on populated areas including churches and shopping centres, according to a police brief seen by AFP.

In June, militants from the Allied Democratic Forces (ADF) group crossed the border from the Democratic Republic of Congo and massacred 42 people, including 37 students, in a gruesome school attack.

It was Uganda's worst attack since twin bombings in Kampala in 2010 killed 76 people in a strike claimed by the Somalia-based Al-Shabaab group.

AFP