The man caught outside Buckingham Palace with a metre-long sword is being questioned by British counter-terrorism police.
The man drove at a police van on Friday evening, then took the sword from the front passenger foot-well of his car, London's Metropolitan Police said.
He shouted "Allahu Akbar" as he was detained by two unarmed police officers, who suffered slight cuts in the incident.
It was too early to say what the man was planning to do, said Commander Dean Haydon, the head of the Met's Counter Terrorism Command.
"We believe the man was acting alone and we are not looking for other suspects at this stage," he said. "It is only right that we investigate this as a terrorist incident at this time."
Europe has been on high alert following a string of militant attacks, including four this year in Britain that killed 36 people. The country's threat level remains at severe, meaning an attack is highly likely.
- Several injured as van hits pedestrians near London mosque
- Van hits pedestrians on London Bridge
- UK teen jailed for Elton John bomb plot
No members of the royal family were present in the palace, Queen Elizabeth's chief residence, which is a magnet for tourists in Britain's capital in the peak August holiday weekend.
"I want to thank the officers who acted quickly and bravely to protect the public last night demonstrating the dedication and professionalism of our police," Prime Minister Theresa May said in a message on Twitter.
The suspect was initially arrested on suspicion of grievous bodily harm and assault on police. He was then further arrested under Britain's Terrorism Act.
Police said they were investigating a 26-year-old man from the Luton area, an ethnically diverse town 55km north of London where police have carried out investigations linked to other militant attacks, including one earlier this year on London's Westminster Bridge.
"My partner saw a sword… as well as a policeman with blood on him, looking like his hand or chest was injured. The police officer had it in his hand, walking away with it," said an unnamed witness quoted by The Times newspaper, who said tourists were running away from the scene.
The suspect was treated at a London hospital for minor injuries