A female student in Branford got a unpleasant surprise Thursday morning when she found an intruder taking a shower in her bathroom, Branford Master Steven Smith said.

When the student left the bathroom to call police, the man apparently left, police said.

“We are certain he was not a Yale student,” Smith said.

Smith sent an e-mail Thursday admonishing Branford students to make sure to close entryway doors and to keep their suites locked.

“Today we were lucky that no one was injured or nothing stolen,” Smith said in the e-mail. “If everyone takes greater care, we will not have to depend on luck.”

The Yale Police Department is investigating the incident.

“We’re looking into it to try to figure out how he gained entrance,” Yale Police Chief James Perrotti said. “It’s still a big mystery.”