A British man encouraged fellow Muslims to murder Gordon Brown and Tony Blair in messages posted on the internet, Preston Crown Court has heard.
Prosecutors accused Ishaq Kanmi, 23, of Blackburn, Lancashire, of devoting himself to stirring up terrorism.
In two messages left on a jihadi website, he claimed to be the leader of al-Qaeda in Britain.
Mr Kanmi denies two counts of soliciting to murder the prime minister and his predecessor.
He also pleaded not guilty to professing to belong to a terrorist organisation, namely al-Qaeda, inviting support for the same organisation, disseminating terrorist publications and collecting or making a record of information likely to be useful to a terrorist.
In one of the postings from January 2008, he allegedly called for "the elimination of political leaders and top of the list Blair and Brown. As God said: 'Kill the non-believers.'"
He also said another objective was "huge attacks, God willing, on centres and places of benefit to the crusaders".
He went on to invite Muslims in Britain to prepare themselves for martyrdom operations and "not lose this golden chance".
Andrew Edis QC, prosecuting, said of Mr Kanmi: "His aim was to persuade others to commit murder, to carry out acts of terror and to engage in martyrdom operations.
"He did what he could to help them by publishing useful information on the internet.
"His loyalty to his form of Islam exceeds his loyalty to this country."
He went on to say Mr Kanmi had become "obsessed" with al-Qaeda and was a "determined supporter" of jihadi terrorism.