The man was shot in the arm and an ambulance was dispatched to the scene.
The 25-year-old is currently in hospital under police guard and a decision will be taken whether he can be transferred into police custody during Sunday morning.
The man has not yet been detained on suspicion of any offence.
Police received several calls on Saturday evening from witnesses reporting that a man armed with a sword was attacking taxis and acting in a threatening manner in the Fredhäll area of Stockholm, according to a report in the Aftonbladet daily.
Police were despatched to the scene shortly after 11pm.
"They met a male person around 25-years-old who appeared psychologically unstable. He waved a sword towards the taxi vehicles and the public. He then attacked the police unit," Mikael Ericsson at Stockholm police told the newspaper.
"They were forced to open fire and shot him in the arm."
An ambulance was called to the location which was then cordoned off by police while a search was conducted for the bullet fired from the police firearm.