A firefighter was treated for burns after being injured tackling a blaze at a house in Cardiff that was being used as a cannabis factory.
At the height of the incident, up to 42 firefighters were used to beat back flames on Clare Road in Grangetown.
South Wales Fire and Recue said they discovered the cannabis factory on the upper floor of the house.
A spokesperson said the mains electricity had been bypassed to power the cannabis factory.
The alarm was raised by a member of the public at 02:48 BST on Sunday, and initially three fire crews attended at the Clare Road address.
But a fire service spokesperson said the house was well alight when the officers arrived.
"There was a severe fire in the roof of the building which had spread to the rear extension and threatened neighbouring properties," said the spokesperson.
"While firefighting, it was indentified that there was a cannabis factory located on the upper floor of the property, with extremely dangerous electrical wiring, which had bypassed the mains meter."
After the discovery of the cannabis farm, a hazardous area response team was also called in, alongside South Wales Police.
"The fire severely damaged the property and it was only the efforts and hard work of firefighters that prevented the fire from spreading to neighbouring properties," added the fire service spokesperson.
"The cause of the fire is still under investigation by South Wales Fire and Rescue Service, however it has to be noted that these cannabis factories do create a danger to residents and firefighters."
The fire service said the firefighter has been discharged from hospital.
South Wales Police said neighbouring houses were also evacuated for a time.
"At this time a joint police and fire service investigation is underway to establish the exact causes of the fire," said a force spokesman.
Cardiff South and Penarth MP Stephen Doughty said he had already been in touch with the police and local councillors.
"I am very concerned to hear the news about this incident. My thoughts are first and foremost with the firefighter who has been injured and with the fire service," he said.
"This is not the first time that facilities of this nature have been found in the city, and they all have one thing in common - very dodgy wiring in the arrangement.
"I certainly will be raising this further to see what the extent of the problem is and what can be done to crack down on it."
Clare Road was closed for 12 hours but has now reopened to traffic.
South Wales Police said anyone with information can contact them on 029 20222111 or Crimestoppers on 0800 500 111.