In this file picture, fire fighters are trying to put out a blaze at a substation: Supplied/City Power.

A homeless man was killed and his friend  injured when a station they were allegedly tampering with blew up in the west of Johannesburg.

This resulted in a power outage in nearby areas including Maraisburg and Bosmont. 

City Power spokesperson Isaac Mangena said the two are believed to have been using the substation as a place to sleep and that it exploded when they tampered with it.

"It is believed that the two tried to open MV link box with the aim of stealing some of the material when it exploded causing the fire that killed one of them.

"City Power would like to warn people against vandalism and using its infrastructure as shelter as this may result in injuries or death," he said.

Mangena said the substation was currently a crime scene and that their technicians would only be able restore power in the affected suburbs after the police were done with investigations.

"City Power extends its condolences to the family of the deceased," he said.