The python that strangled two young brothers in Canada had been kept in the pet store owner's apartment where the boys were sleeping and not with the other animals in the shop below, authorities have revealed.

Police are treating the deaths in Campbellton, New Brunswick, as a criminal case. Autopsies on Noah Barthe, 4, and his brother Connor Barthe, 6, were performed on Tuesday.

The brothers had been visiting the apartment of a friend whose father owned an exotic pet store on the floor below, Canadian police Sergeant Alain Tremblay said at a news conference in Campbellton. Tremblay said the African rock python, about 4.3 meters (14f) long and 45kg (100lb) in weight, had been kept inside the second-floor apartment, not inside the pet store as authorities had previously stated.

Tremblay said the snake was housed in a large glass enclosure that reached the ceiling of the apartment. It escaped through a small hole in the ceiling connected to the ventilation system. He said the snake made its way through the ventilation system and moved towards the living room, where the boys were sleeping. The pipe collapsed and the snake fell into the room.

Steve Benteau, a spokesman for the provincial natural resources department, said no permit was issued for an African rock python and provincial authorities had not been aware it was being kept at the apartment. The department said the species was generally only permitted in accredited zoos unless there was a special permit.

The pet store owner, Jean-Claude Savoie, told the Global News television station that he didn't hear a sound and discovered the "horrific scene" when he went into his living room on Monday morning.

"I can't believe this is real," Savoie said.

He said the boys were the children of his best friend and were often at his apartment to visit his son. Savoie said the python, which he owned for at least 10 years, had been kept alone in its enclosure and was not handled by anyone else.

A photo from their mother's Facebook page of Noah and Connor Barth, who were strangled by an escaped python. Photograph: Mandy Trecartin/Facebook

Police said the snake was killed by a veterinarian. It was sent for a necropsy to confirm the type of snake and help understand what may have caused it to attack.

Snake experts said it was possible that the python was spooked and simply clung to whatever it landed on through reflex. Others speculated that the snake picked up on scents that were on the boys from playing with other animals that day. Family spokesman Dave Rose, the boys' great-uncle, said the brothers had spent Monday at Savoie's family farm and played with different animals before staying over at the apartment.

Paul Goulet, founder and co-owner of Little Ray's Reptile Zoo in Ottawa, said snakes did not recognise humans as a source of food but if the children smelled like animals it could explain an attack.

"If a snake sees an animal moving, giving off heat and smells like a goat, what is it? It's a goat," said Ottawa reptile zoo owner Paul Goulet said. "The reasonable explanation of how this has happened is that they had been playing with farm animals, they did smell like their prey items and the snake sadly enough mistook them as a food item when they weren't."

Snake expert John Kendrick, from Hamilton in Ontario, said it was possible the python just held on to what it landed on.

"A snake that size that was just trying to hold on securely enough to make sure he felt like he wasn't falling or going anywhere; he has enough muscle power to cut off circulation," he said.

"Once they are in constricting mode, any part of their body that is touching something that moves, they'll wrap it."

The friend of the boys was sleeping in another room and was unharmed.