A prison officer "thought he was going to die" when he was held hostage by three prisoners who were demanding the release of Abu Qatada, a court has heard.
The alleged incident took place days after the murder of Fusilier Lee Rigby, at a time when relationships between prison staff and Muslim inmates were said to be "strained".
Feroz Khan, 26, David Watson, 27, and Fuad Awale, 26, are on trial accused of the false imprisonment of Richard Thompson while they were all at HMP Full Sutton in North Yorkshire on Sunday May 26 last year.
Khan and Awale are also accused of threatening to kill the officer, and Khan is charged with causing grievous bodily harm to him, and assault occasioning actual bodily harm on a second officer, Rachel Oxtoby.
Awale allegedly said to the prison officer: "I've killed two people. I'll kill you."
Woolwich Crown Court heard Mr Thompson was captured and held hostage for about four and a half hours, and that some of the defendants were armed.
Ms Sally Howes QC, prosecuting, said in her opening speech: "This was not a spur of the moment opportunistic incident."
She said it was "carefully thought out, fully prepared and well planned".
The court heard laundry bags containing clothes, food and toiletries were left in the vicinity "indicating careful planning over a period of time".
Ms Howes pointed out the alleged incident took place in the same week Fusilier Rigby was murdered.
"Relationships between prison staff and some of the Muslim inmates became strained," she said.
The defendants made three demands when they held Mr Thompson hostage in a secure cleaning office in a communal area of the prison, the jury heard.
They are said to have called for the release of Abu Qatada and for him to be flown to Afghanistan, and called for the release of Roshonara Choudhry and for her also to be flown to Afghanistan.
And thirdly they called for these demands to be broadcast by the media, the court heard.
Mr Thompson's ordeal began when he was going into the office after the evening meal to make a phone call, the jury was told.
Noticing a "sudden movement", he turned to look up and was punched in the face by Khan, before being bundled into a chair, the prosecution said.
In footage shown to the court, jurors could see what happened in the moments immediately after the alleged incident began as prison officers were seen running towards the room and inmates gathered to watch what was happening through the glass.
Awale is accused of holding a sharp instrument to Mr Thompson"s throat, and saying: "I've killed two people. I'll kill you."
Khan allegedly told Mr Thompson he was being targeted because he was "ex-military", which the prison officer said he was not.
Khan said someone "has to make a sacrifice", the jury heard.
Ms Howes said: "Mr Thompson thought he was going to die."
Khan is alleged to have said Mr Thompson would be killed if the defendants' demands were not met.
The prosecutor told the court Khan made an announcement on the tannoy telling the prison's inmates what was unfolding.
In a note sent out from the room, the defendants said they did not consider themselves to be terrorists, and said they hope the UK Government "might or will establish Sharia law", Ms Howes said.
The court heard a negotiator, trained in handling scenarios like this one, explained to the defendants that they had chosen a bad holiday to take Mr Thompson hostage, that the majority of people would be "tuning into the final of Britain's Got Talent".
Ms Howes said he told them: "Your timing is s**t."
Awale is alleged to have said again: "You do know that I have killed two people before so killing a third doesn't matter to me."
At around 9pm a "dedicated extraction team" was deployed, and officers in riot gear forced themselves into the room.
Mr Thompson was found to have tender bruising around his right eye, and his right cheek bone had a fracture which required surgical treatment.
Ms Oxtoby had bruising and slight scratching due to Khan having a "sharp implement" which he allegedly stabbed at her arm when she was trying to hold the door open.
In an interview with police after his arrest, Khan made a full admission that he never believed that Qatada or Choudhry would be released, the court heard.
Ms Howes said his "main aim was to attract media attention", and said once his demands were on TV he would have stopped.
Khan apologised for the assault on Ms Oxtoby, the jury was told.
He admitted making a threat to kill Mr Thompson (indirectly through another prison officer), and he accepted that both Mr Thompson and the other officers would have been "scared and nervous".
Awale and Watson made no comment to police, Ms Howes said.
The prosecution barrister said Mr Thompson "definitely believed that he was going to be killed".
The alleged incident took place in an area which is seen as a "flashpoint for trouble" by prison staff, as there is a "steady flow of inmates" there.
Ms Howes told the jury about how one particular prison officer took a great interest in the Muslim inmates, taking time to talk to them and hear their point of view.
She said each inmate is assigned to an individual prison officer, and Khan was assigned to this officer.
On the Friday following the murder of Fusilier Rigby - two days before the alleged incident - Khan and two other inmates allegedly walked out of prayers after the imam offered condolences to the Rigby family.
Speaking later to the prison officer about this he is alleged to have explained why such things, such as the murder of Fusilier Rigby, happen.
Ms Howes said Khan told him: "George W Bush started the war on terror, but it wasn't two countries fighting each other. It was an invasion of Iraq and Afghanistan."
He is alleged to have said: "Muslims are fighting back."
Ms Howes said Khan told the officer: "And that's why people are getting killed."
The court heard he said that the fight will continue until Sharia law is established in every country.
Khan said there are three types of people - Muslims, non-believers and hypocrites, the jury heard.
Hypocrites are Muslims who do not pray, watch porn and listen to loud music, he is alleged to have said.
The prison officer's view was that Khan was "very knowledgeable" on the history of the Muslim world, and was aware that there was tension involving him in the prison.
The court heard the prison officer was sure Khan was "up to something".
Staff in the prison noticed that Khan was holding "hushed meetings", the prosecution said.
The court heard Ms Oxtoby said there were "problems and difficulties" from the moment inmates were unlocked.
The prosecution said Ms Oxtoby explained that there was a feeling amongst the prison staff that "no Muslims were going to take us hostage".
Ms Howes said this suggested that there was "a heightened sense of anxiety" at that time.
The defendants deny the charges.
The trial is expected to last three weeks, with the possibility of it running into a fourth week.
It was adjourned until 10am tomorrow.