Indonesian police have uncovered a plot to kill Susilo Bambang Yudhoyono, the president, and other senior government officials, authorities have said.
General Bambang Hendarso Danuri, the national police chief, said on Friday that a group of attackers planned to launch their assault during this year's independence day ceremony and declare an Islamic state.
"They were confident that all state officials and dignitaries would be there," he said.
"Killing all the state officials would have accelerated the transition from a democracy to a state controlled by Islamic Shariah law."
Al Jazeera's Step Vassen reporting from the Indonesian capital of Jarkata, said: "It's a very high-level and sophisticated plot."
Some of the information on the plot came from a series of raids this week in and around Jakarta that yielded 20 arrests as well as a supply of assault rifles, ammunition, telescopes and jihadist literature.
Most of those arrested were believed to have trained at the Aceh camp, run by a group called al-Qaeda in Aceh, a new splinter of the Jemaah Islamiyah group.
"This new group established itself in Aceh and emerged with new tactics. Instead of bomb attacks, they conducted military training which made police believe that new tatics will be to assassinate people instead of planting bombs," our correspondent said.
National police chief Danuri said the plan was to launch attacks in Jakarta against foreigners - especially Americans, and attack and control hotels, imitating what happened in Mumbai, India's financial capital.
"If we had not detected them and their military training had been successful, then they would have assassinated foreigners," he said.
The aborted plan is the second alleged plot within a year against the Indonesian president.
Police said last August they had evidence of a plan to assassinate Yudhoyono by detonating a car bomb close to his motorcade.
Indonesia has battled armed groups since 2002, when fighters bombed a nightclub district on Bali island killing at least 200 people, most of them foreigners.
Since the nightclub attack, a much-praised regional security crackdown has seen hundreds of fighters killed or captured and convicted, but they have proved to be a resilient foe.
The last major attack was in July 2009 when suicide bombers targeted luxury hotels in Jakarta.