Police were called to Centrelink in Gosnells following reports a man was smashing windows and a glass door with a hammer, while up to 30 people were trapped inside.
A police spokesman confirmed police were called to the Lissiman Street address about 9.10am.
A Gosnells resident, who witnessed the incident, said the man had allegedly become agitated after being told he had to use online services.
He allegedly pulled out a hammer and smashed the glass door before exiting the building and smashing the windows from the outside.
The witness said other customers were forced to wait in a back room until the frightening incident ended.
“We all got pushed out to the back of the building and had to wait until it was over,” he said.
“There were probably about 30 of us locked in the back for about 10 or 15 minutes.”
A message was later left on a whiteboard at the front door explaining the building was temporarily closed and customers would have to attend either Armadale or Cannington.
The man was believed to have been detained a short time later in Albany Highway, though this was yet to be confirmed.