Carmen Brito was asleep Friday night when she suddenly woke up gasping for breath. Outside her small studio, one floor down from where a raging concert was taking place, she saw her neighbor’s wall on fire.

“I’m pretty sure I was the first person to see the fire, and when I saw it, it was bigger than I was,” said Brito, 28. The inferno killed at least 33 people and is regarded as one of the worst structure fires in the United States in over a decade.

On Sunday, firefighters were digging through the ruins of the warehouse, where people had gathered for an electronic dance show Friday when flames ripped through the building, collapsing the floors. The search of the building, which only had two exits, could continue for days, officials said at a news conference, warning that the death toll could climb considerably higher.

Authorities said Sunday that seven families had been notified that loved ones had died in the fire, while many more awaited further news. One victim was the son of a local law enforcement officer, according to Sgt. Ray Kelly of the Alameda County Sheriff’s Office. “This tragedy has hit very close to home for our agency,” he said. Other victims were from countries in Europe and Asia. The officials were in the process of contacting agencies abroad.

Brito was just one member of a community of roughly 25 artists who inhabited the building illegally — but in plain sight of Oakland city officials. The building, which was known as the Ghost Ship and has been under investigation for code violations, had a permit to function as a warehouse, but not as a residence or for a party. A criminal investigation began on Sunday.

Brito said the fire started at the very back of the building, in a studio next to hers, when the couple who occupied the room were gone. She said a firefighter investigating the blaze had asked her whether the couple had recently installed a refrigerator, which they had, raising the possibility that the building’s electrical system played a role. Officials said it was too early to determine the cause of the fire.

Brito and another survivor, Nikki Kelber, 44, said the building’s renters had repeatedly asked its owner to upgrade the electrical system, which failed often enough that residents had flashlights in their studios.

Kelber and Brito said that the building had many fire extinguishers and that one of the residents, Max Ohr, tried to use one on the flames but soon gave up.

“It was like trying to put out a bonfire with a squirt gun,” Brito said.

The residents of the building said they had been priced out of parts of the San Francisco Bay Area that have become increasingly unaffordable. They called themselves refugees and were happy to be living among a community of like-minded artists paying an affordable rent.

Oakland itself has seen rents and home prices skyrocket with the technology boom. The high cost of living has led to alternative housing arrangements across the region, from a community of homes made of shipping containers to lines of recreational vehicles on Silicon Valley side streets.

But these spaces, while often illegal, are subject to the same market forces rippling through the broader market. That has given outsize power to the so-called master tenants who control the lease of a building and, at least in some cases, can make money by subletting to struggling artists willing to live in substandard conditions.

The Ghost Ship was one of these illegal living spaces. Residents and visitors described it as both a haven for artists and a fire trap, with a warren of trailers, broken pianos and stacks of wood and a complex network of electrical cords and generators.

It was home for jewelers, metalworkers, dancers, musicians and others, and parties that brought hundreds to its labyrinthine corridors. But it was also plagued by discord and the whims of its two master tenants, Derick Ion Almena and Micah Allison, who lived there with their three children, ages 13, 7 and 6.

Several residents said they were lured in by the promise of cheap rent and a creative community, only to find that their new home had no heat, sporadic electricity and a master tenant — Almena — who would bring in homeless people to harass residents who crossed him. Almena was serving a sentence of three years’ probation, having pleaded no contest in January to a felony charge of receiving stolen property. Almena and Allison could not be reached for comment Sunday.

“A lot of people were his friend because they believed in the miracle,” said Shelley Mack, 58, who moved into the space in October 2014, paying $700 to live in a mobile home inside the warehouse. “But it was a sick place.”

Mack left after several frightening incidents, she said. In one, she said, a friend of Almena’s pulled a gun on several residents.

In March 2015, the Alameda County Social Services Agency removed Almena and Allison’s children from their custody after relatives expressed concerns about safety. The agency returned the children in June of this year.

People familiar with the space questioned why the police did not do anything to shut down the Ghost Ship.

“That place was a tinderbox,” said Danielle Boudreaux, 40, who had visited the warehouse. “Anybody who went in there who had any kind of authority should have not allowed it to continue.”

Ohr, who took on a supervisory role among tenants, said they told the landlord that the electrical system needed upgrading. “We reached out on multiple occasions, complaining that the power wasn’t working,” Ohr said. “They made no attempt to make it right.”

The area where the fire had started had been closed off to the partygoers and was “unmonitored,” Ohr said. “There are plenty of signs that point to it being an electrical fire.”

Kelber’s studio was near one of the building’s exits, and when she spotted a “ball of fire” coming down the hallway she had only seconds to react. “After 15 seconds, the power went out, and another 30 seconds later it was completely engulfed. It went so fast.”