It was the last day of shotgun season for deer hunting and the state forest was the place to be to bag a buck before the sun went down. Or a land bank property. Or a private estate, for those with permission.

No hunter would have thought to look inside the old Edgartown School, where one deer was either smart enough or lucky enough to avoid the business end of a shotgun.

The deer was discovered last Saturday morning inside the vacant brick building that formerly housed the school just off the Edgartown West Tisbury Road. All the doors and windows were locked tight.

“I don’t have a clue how that deer got in there. Not a clue,” confessed a bewildered Edgartown fire chief Peter Shemeth this week. “We walked around and made sure all the doors were locked and windows were secured. Maybe somebody went inside to get something and it ran inside, maybe a door was open and it blew shut . . . but those are just maybes.”

Mr. Shemeth said he and assistant fire chief Scott Ellis were at a crafts fair at the new Edgartown School next door on Saturday morning when Stephanie Immelt, an Edgartown police officer, approached them and said she saw what looked like a deer through a window of the old school.

“We thought at first somebody put up a deer target inside the school as a joke. Turns out we were wrong,” Mr. Shemeth said.

The three public safety officers left the fair, walked over to the old school and used a set of keys to get inside. They found that the deer was not a drawing or target, but the real thing. When they first entered the building they found a trail of blood and piles of droppings. Then they spotted the young buck standing in the hallway.

“It continued to stand there until he saw us, and then he ran into one of the classrooms,” Mr. Shemeth said.

The rescuers kept their distance, knowing that a confused deer could charge and strike them with its antlers or hooves. They described the deer as a medium-sized, younger buck with bumps on the top of its head that appeared to be small antlers.

They opened the back door hoping the animal would run outside and managed to get the deer out of the classroom, but it ran into a nearby bathroom. When they finally corralled the animal out of the restroom it broke into a full gallop down the hall and ran headfirst into a set of glass panels on the inside of a door.

After more coaxing they finally managed to get the deer into a courtyard between the two schools. Once outside it ran toward the new Edgartown school, jumping at a number of closed windows. After several minutes the deer turned back toward the old school, jumped over a four-foot-high chain link fence and bounded out of sight.

Mr. Shemeth said it was unclear how long the animal was inside the school.

“I talked to someone who said they thought they saw it in there on Friday. When you take into account it had no food or water but still had the energy to run the way it did when we found him, it would seem to indicate he was in there for a few days at most,” he said.

Mr. Ellis said there was a large amount of blood in one classroom, although he personally did not see a lot of blood on the animal itself.

Chief Shemeth said the rescue workers did a thorough inspection of the entire building after setting the animal free. There was not a single door open or even unlocked, he said, nor any open windows. He said they did find a broken window, but it was not nearly big enough for a deer to pass through.

Mr. Ellis concurred. “All the doors and windows were closed and locked. Maybe somebody put the deer in there as a joke,” he said,

Gus Ben David 2nd, former longtime director of the Felix Neck Wildlife Sanctuary and owner of the World of Reptiles in Edgartown, said the description of the deer indicates it was a button buck — a male deer born this summer that is still largely dependent on its mother.

Mr. Ben David speculated the young male could have been separated from its mother or chased by dogs or hit by a car.

“Something panicked that animal. That seems clear. It is not uncommon for a deer to jump at a window when it is in that state. There have been instances here on the Vineyard of deer jumping directly into a plate glass window of a store when it is panicked like that,” Mr. Ben David said.

But with no broken window large enough to account for the young buck, the mystery of how the deer got into the school in the first place remains unsolved.