The Metropolitan police are to launch an investigation after dramatic footage emerged that appears to show a police officer attacking a car after the driver refuses to get out.

The clip, shared on social media and viewed more than 40,000 times, shows what appears to be a police officer – filmed from the position of the driver – repeatedly telling him to “get out of the car”, adding: “You’re not allowed to drive it.”

In the footage, which was shared on Saturday by a former member of the music group So Solid Crew, the officer then appears to lose his temper yelling, kicking and pulling at the car door in an attempt to open it. He then reaches for his baton and starts hammering the car window with it.

The man inside filming tells the police officer that he has a licence and insurance, at which point the officer can then be seen repeatedly striking the windscreen, resulting in the glass shattering, while another police officer watches on by a police car.

The man inside the car says: “You’re smashing this for no reason. Look what they are doing to my car.”

The police officer then starts slicing around the damaged area of the windscreen with what looks like a penknife, to make the hole bigger. When asked by the driver what the problem is, the officer tells him he is “not allowed to drive”.

The video has been shared thousands of times on Twitter and Instagram, where commentators describe the officer’s actions as “mindless vandalism and intimidation”.

The driver, who filmed the footage, gave his name as Leon. He said the incident took place on Friday evening in the Gospel Oak area of north London, and said it was a case of “mistaken identity”, describing the officer’s actions as “a completely unlawful act”.

Towards the end of the video, a police officer calls him TJ, to which the man replies: “I am not TJ, I am not TJ.”

When contacted about the footage, a spokesman for the Metropolitan police said he was aware of it and was looking into it. The Met later released a statement confirming that the incident took place at about 5pm on Friday in the borough of Camden.

“The footage will now be subject to an investigation by officers from the directorate of professional standards (DPS),” the statement said.

“As soon as the MPS was made aware of the footage, the DPS was contacted immediately. The individual who uploaded the footage has been contacted by DPS officers. As this matter is in its early stages, the officers have not been suspended or placed on restricted duties.

“No one was arrested during the incident,” it added.

Leon, who said he spent the evening in hospital because there was glass in his eyes, said it was “complete madness” and that he was “still in shock”.

“Every time he smashed the glass, fragments of glass were just ricocheting in my face,” he said.