The paramedics managed to avoid being hit by the hail of bullets fired by the would-be patient, who then fled the scene.
The man was later found dead in a nearby flat, with police saying he'd taken his own life.
The bizarre sequence of events played out it the Grimsta neighbourhood of Vällingby, west of Stockholm, when two paramedics and a trainee arrived to assist a patient who had called for help.
"The ambulance workers met a man at the entrance. He wanted to lock his apartment and went back in. When he came back out he pulled out a weapon and fired several shots at them," police officer Per Gerdin told the TT news agency.
The man then went back into his apartment and soon thereafter, smoke could be seen coming out of the flat.
A police emergency response team was dispatched to the scene in an attempt to establish contact with the man.
"When they didn't succeed, they went in. They found the man dead. He'd shot himself," said Gerdin.
The paramedics who were in the line of fire escaped physical injury, but were traumatized by the shooting.
"It's was a tragic and strange event," said Gerdin.
The head of ambulance operator Aisab called the incident unprecedented.
"I've worked within the ambulance service since 1976 and never heard of anything like this -- a patient pulling a weapon and shooting at staff," Aisab CEO Åke Östman said in a statement.
The company plans to launch an investigation into the incident to see if more could have been done to protect the ambulance workers.