BERLIN — The Berlin zoo’s celebrity polar bear, Knut, drowned after swelling of his brain caused him to collapse and fall into his enclosure’s pool, experts said Friday.

A necropsy of the four-year-old bear who died suddenly two weeks ago showed he was suffering from encephalitis, an irritation and swelling of the brain that was likely brought on by an infection, pathologist Claudia Szentiks said.

It remains unclear what that infection was, but Achim Gruber, a professor of veterinary medicine at Berlin’s Free University, said it likely was a virus.

“We believe that this suspected infection must already have been there for a long time … at least several weeks, possibly months,” Huber said, although he added that there had been no sign of anything amiss in the bear’s behavior.

Knut died March 19 in front of hundreds of visitors at Berlin zoo, turning around several times and then falling into the water in his enclosure. Polar bears usually live 15 to 20 years in the wild and even longer in captivity.

Experts who examined Knut found massive quantities of fluid in his lungs, supporting the conclusion that the immediate cause of death was drowning. But they said that even if he hadn’t fallen into the water he likely wouldn’t have survived.

“Given the massive scale of the inflammation, Knut would probably have died sooner or later — it wouldn’t really have been possible to save him,” said Szentiks, a pathologist at the Leibniz Institute for Zoo and Wildlife Research in Berlin, which led the examination.

Experts ruled out rabies, botulism and bovine spongiform encephalopathy, also known as mad cow disease, as causes of the encephalitis that led to the animal’s spasm and collapse, said Szentiks.

Animal rights groups have alleged that the bear was traumatized by living in a zoo environment. But Szentiks told reporters that the examination showed no indications of any chronic stress.

The pathology team, which will continue searching for the cause of Knut’s illness over the coming weeks and months, also said there were no signs of any genetic defects.

Knut, who was born in December 2006 at the zoo, quickly rose to celebrity status as an irresistibly cute, fluffy cub.

Knut was rejected by his mother at birth — along with his twin brother, who only survived a couple of days. He attracted attention when his main caregiver, Thomas Doerflein, camped out at the zoo to give the button-eyed cub his bottle every two hours.

The bear went on to appear on magazine covers, in a film and on mountains of merchandise.

Doerflein, the zookeeper who raised him, died in 2008 of a heart attack.

The zoo now wants to have Knut stuffed and put on display at Berlin’s Museum of Natural History.

The museum’s acting director, Ferdinand Damaschun, suggested that Knut could become part of an exhibit on climate change, but said there is “no need for excessive haste” in making decisions.