Climate activist Greta Thunberg faced arrest after defying police orders to move from a protest site, a court heard.
The 21-year-old was detained during a rally near the InterContinental Hotel in Mayfair on 17 October.
Oil bosses had been gathering inside for the Energy Intelligence Forum.
Ms Thunberg denied breaking the Public Order Act 1986 when she appeared at Westminster Magistrates’ Court on Thursday.
She is charged with breaching section 14 of the act by obstructing the entrance to the hotel.
The court heard from Supt Andrew Cox, the top Metropolitan Police officer on the scene that day, that the protesters had ignored police requests to move. Protesters began to assemble near the hotel at about 07:30 BST and police tried to negotiate with them to allow access for the public, which had been “blocked”, the court heard.
The court was told that as the protest went on the “majority” of people inside the hotel were trapped and people outside could not get in.
Supt Cox told the court he had no option but to enforce a section 14 condition at about 12:30 BST, which ordered that the protest could only continue on the pavement to the south of the hotel.
Officers spoke to individual protesters and told them about the section 14 condition, the court heard, including Ms Thunberg, who was standing outside the hotel entrance. Prosecutor Luke Staton said she was told by one officer that she would be arrested if she did not comply and, while that officer was busy elsewhere, another officer approached Ms Thunberg and “gave her a final warning”.
“She said that she was not going anywhere, and so she was arrested,” Mr Staton said.
Ms Thunberg appeared in court with two Fossil Free London protesters and two Greenpeace activists, who also denied the same offence.
The Swede scribbled notes in a small notebook as the trial went on.
Before entering the court Ms Thunberg, the leader of the school strike for climate movement, passed by environmental protesters who were showing their support for the defendants.
They waved large yellow banners that read, “climate protest is not a crime” and cardboard signs saying, “who are the real criminals?”, as well as placards.