A South Africa government official was held at gunpoint for over four hours on Wednesday by a man frustrated at waiting for an identity document.
It can be a frustrating wait for an identity document
Police admitted later that the gun used in the hold-up was in fact a toy.
The employee was taken hostage at the Johannesburg Home Affairs office about 1500 local time (1300 GMT). A large police contingent arrived at the scene.
A man was arrested at the scene and is due to appear in court on Thursday. But he got his document in the end.
The drama started when the man demanded his identity document that he had been waiting for for three months, police spokesman Superintendent Chris Wilken said.
The man refused to leave until his document arrived from the Department of Home Affairs head office in the capital, Pretoria, about 50 km away, and threatened to kill the hostage if the document did not arrive.
Large numbers of police and hostage negotiators tried to persuade the man to release the hostage.
Later police fired stun grenades, prompting a family member of the alleged hostage taker to cry: "Oh no, they shot him. This cannot be happening to him. What has he done?"
The man was arrested about 1945 local time, and his hostage released unharmed.
Officials handed the man his identity document, which by now had arrived from Pretoria.
Early on Thursday, Supt Wilkens confirmed: "Ja, he used a toy gun."