Anger smouldered in Brazil on Monday after a fire destroyed the National Museum, a cherished historical repository that lacked a sprinkler system and which had suffered years of financial neglect.

Outside the entrance to the elegant park that houses the 200-year-old former Imperial Palace, police in riot gear shot tear gas into a small, angry crowd that tried to enter, live TV images showed.

The rising tensions reflect anger over the destruction of the much-loved yet dilapidated museum, which suffered from declining federal funding. The fire stirred emotions in Brazil, whose angry electorate is reeling from a frail economy, widespread graft and rising violence ahead of an unpredictable presidential election in October.

"Our community is very mobilized, and very indignant," said Roberto Leher, the rector of the Rio de Janeiro federal university, which administers the museum. "We all knew the building was vulnerable."

Authorities have yet to say what caused Sunday's fire.

Recriminations flew over who was responsible for the loss of at least part of Latin America's largest archive of historical artifacts, objects and documents. (Mario Lobao/Associated Press)

Brazil's culture minister Sergio Leitao told the Estado de S.Paulo newspaper that the blaze was likely caused by either an electrical short-circuit or a homemade paper hot-air balloon that may have landed on the roof. Launching such balloons is a long-held tradition in Brazil and they routinely cause fires.

The culture ministry did not immediately respond to a request for comment.

The museum's pastel yellow facade remained standing but a peek inside its giant windows revealed a roofless interior of blackened hallways and charred beams. Every so often, firefighters emerged with a pot or a painting they had managed to rescue.

Researchers, students and others who worked in the museum, where 20 million artifacts were likely destroyed, huddled in groups outside, consoling one another and wiping away tears.

But as the day progressed, ever more people tried to enter the park to get a glimpse of the building's burned shell and police eventually opened entry to the park.

It's not known how many of the museums 20 million pieces were destroyed or saved from the fire. (Silvia Izquierdo/Associated Press)

Luiz Duarte, vice-director of the museum, told Globo TV the institution had been neglected by successive federal governments, and that a 21.6 million real ($6.85 million Cdn) financing plan with the state-run development bank BNDES announced in June included, ironically, a plan to install modern fire protection equipment.

Duarte also said museum officials were seeking renovation funds in 2013, at the same time that Brazil was spending millions to build stadiums for the World Cup, which it hosted the following year.

"The money spent on each one of those stadiums — a quarter of that would have been enough to make this museum safe and resplendent," he told Brazilian TV. He said the responsibility for the museum's destruction lay squarely with federal authorities.

Fire hydrants dry, no sprinklers

Roberto Robadey, commander of the Rio fire department, told reporters on Monday the hydrants outside the building were dry, which forced firefighters to use water from a nearby lake and rely on water trucks. But the building burned too fast for any of that to help.

"In an ideal world, we would have many things that we don't have here: sprinklers inside the building," he said, adding that the fire department would investigate its response and take action if needed. "Yesterday was one of the saddest days of my career."

The museum is not the first to burn down in Brazil, where public money for cultural projects has been falling after a deep recession. In 2015, for example, the prestigious Museum of the Portuguese Language in Sao Paulo was destroyed by a fire.

In 2016, President Michel Temer was forced to reinstate the Culture Ministry after an outcry from some of the country's top artists over his policy to fold it into the Education Ministry to save money.

On Monday, his office said he had met with representatives from major Brazilian companies and banks to look into ways to help rebuild the museum "as soon as possible."

Firefighters had to truck water from a nearby lake, but the fire moved too quickly for their efforts to help. (Mario Lobao/Associated Press)

Renato Rodriguez Cabral, a teacher in the geology and paleontology department, said the museum's decline did not happen overnight.

"This was a tragedy foretold," Cabral said as he hugged students and coworkers. "Successive governments would not provide funds, they would not invest in infrastructure."

Cabral said the building received new wiring about 15 years ago, but that clearly there was not a sufficient plan to protect the museum from fire, adding: "The firefighters basically could only watch the blaze."

The National Museum's collection ranged from archeological finds to historical memorabilia.

The museum, which is tied to the Rio de Janeiro federal university and the education ministry, was founded in 1818 and housed several landmark collections, including Egyptian artifacts and the oldest human fossil found in Brazil.

The destruction of the building, where emperors once lived, was an "incalculable loss for Brazil," Temer said in a statement.

His office did not respond to requests for comment on widespread allegations of neglect.

With files from The Associated Press