A suspect deliberately drove a car at police outside Buckingham Palace and then “reached for a 4ft sword”, the Metropolitan Police have said.
Three officers were injured after tackling a man who drove a blue Toyota Prius at a marked police vehicle on Friday night.
Commander Dean Haydon, of the Metropolitan Police counter-terrorism branch, said: “Uniformed officers then confronted the driver of the vehicle and during that confrontation the driver reached for a four-foot sword that was in the passenger footwell.
“CS gas was used as part of the arrest and during the struggle the individual repeatedly shouted the words Allahu Akbar.”
A 26-year-old man from the Luton area is in custody at a central London police station.
Scotland Yard said the incident is being treated as terrorism.
The suspect was arrested at the scene on suspicion of grievous bodily harm and assault on police. He was further arrested under the Terrorism Act 2000.
It is understood that no members of the royal family were in Buckingham Palace when the attack happened on Friday just after 8.30pm.
It took place in a restricted area in Constitution Hill near to Buckingham Palace, when a car deliberately drove at a police van and stopped in front of it.
The officers, who were unarmed police constables and from Westminster borough, got out of the van and approached the car.
Two of the officers were taken by ambulance to hospital with minor cuts and discharged a short time later. The third officer did not need hospital treatment.
With the start of the busy Bank Holiday weekend, which includes the Notting HIll Carnival, people across London will see an increased police presence on the streets.
Mr Haydon urged members of the public to remain vigilant and alert.
Scotland Yard said that officers from the Counter Terrorism Command are carrying out searches in the Luton area.
In a statement, Mr Haydon said: “We believe the man was acting alone and we are not looking for other suspects at this stage.
“While we cannot speculate on what the man was intending to do - this will be determined during the course of the investigation - it is only right that we investigate this as a terrorist incident at this time.”