Latvian authorities said the building's operators had recently conducted unauthorised renovation work.
Eight people, some of them foreign nationals, died early on Wednesday in a fire at a hostel that was said to be operating illegally in the centre of the Latvian capital, Riga, according to police.
Firefighters and rescuers from the Latvian State Fire and Rescue Service said they were alerted to the scene on Merkeļa Street in the city centre at around 5 am.
The building’s sixth floor and the roof were on fire, and rescuers found eight people dead. They evacuated a further 24 from the premises, news agency Baltic News Service said.
Latvian state television broadcast footage of flames pouring out of the top of the building, multiple fire engines and a ladder extending to the top, from where two firefighters were aiming a hose at the blaze.
Latvian authorities said the state-owned building was apparently housing an illegal hostel and the operators had recently conducted unauthorised renovation work.
Some of the victims were foreigners, Riga Mayor Martins Stakis told reporters.
The building is located in the commercial centre of Riga close to the city's main bus and railway stations.
Riga City Council said in a press release that it was providing assistance to the victims and those without a place to stay in connection with the fire.
The council's president, Mārtiņš Staķis, said that he would organise for information to be gathered on whether there are currently any apartments in the municipality that are also housing illegal hostels.
"We see that the consequences of illegal business can be very tragic," Staķis said in the release. "Not only (in terms of) tax evasion, but also loss of life. Swift action is needed to give the services more powers to take action against such illegal 'business' operators."
The 8 Merkeļa Street apartments were "on the regular route of the Riga Municipal Police," according to the statement.
Police had also received information about repeated drug use at this address and state police had investigated these cases, the release added.
They had also issued a total of 17 fines at the apartments for smoking in common areas, drinking alcohol in public, not wearing a mask, among other offences.
The police had also responded to 16 complaints about noise, drinking and fighting at the address.
The Riga Construction Board conducted inspections at 8 Merkeļa Street, as well as numbers 21 and 22, in January and ordered the owner to stop the use of the "non-conforming premises" and "remedy the consequences of the illegal construction within six months".
There was no immediate danger, such as a risk of collapse due to unstable structures, according to the press release.