The Metropolitan police said the man -- in his 30s -- was arrested after being disabled with a stun-gun for possession of a knife and there were no reports of any injuries.
The police said it will not declare it as a terror incident until the Counter-Terrorism Command has investigated the motive behind the incident.
"At 11:10 AM on Fridayofficers on routine duties near to the Carriage Gates entrance to the Palace of Westminster became aware of a man acting suspiciously. The officers approached the man in order to speak with him. The man reached for a knife, and police discharged a Taser," the Met police statement said, adding that there were "no injuries" during the incident.
"At this time it is too early to understand the motivation so we have not declared this a terrorist incident. However, given the location, the circumstances and recent tragic events, the Counter Terrorism Command will be investigating this incident. We remain open minded as to whether terrorism was a motive," police said.
More From This Section
Witnesses reported hearing "knife, knife, knife" as armed officers swooped on the suspect.
The bearded man, wearing a grey hooded top, ran towards the St Stephen's entrance of the Houses of Parliament, which is the main visitor's entrance to the building.
Bradley Allen, a 19-year-old, outside the Parliament at the time, said he saw the man with clenched fists moments before he was detained.
"He stared at me and my mate and we walked past him. Within seconds there was a shout and police ran out of the front gate shouting at him 'Get on the floor, get on the ground'," he told reporters.
It is feared the incident may have been an attempted copy-cat terror attack from March, when Khalid Masood rammed a car into the side of the Palace of Westminster, which houses the UK Parliament, killing four people, and got out to stab to death a police officer on guard at the House of Commons gates.
The use of armed officers and physical barriers have become more visible, while a permanent barrier has been erected to protect pedestrians on Westminster Bridge, where Masood murdered five people and injured more than 50 others.
In April, Mohammed Khalid Omar Ali,a 27-year-old foreign-born British national wasarrestedon suspicion of carrying knives in a very public operation near the Parliament Square as part of an intelligence-led operation.
London has been on higher alert since the recent terrorist attack on London Bridge and Borough Market on June 3, which claimed eight lives, and the concert bombing in Manchester in which 22 people were killed.