A man was shot and killed Tuesday at the Fresno (CA) Police Department headquarters in downtown Fresno after officials say he attacked a detective.

"Let me start by saying that I'm very relieved this community did not lose a police officer this afternoon," said Fresno Police Chief Paco Balderrama.

Balderrama says it was just before noon Tuesday when a man somehow got inside the building, went into a detective's office and struck him over the head multiple times.

Officials say it's unclear if the suspect used a knife or something from the detective's desk, but the officer had lacerations to his head and neck.

Chief Balderrama described the detective as small in stature and the suspect as about 6 feet tall and around 300 pounds.

Authorities are trying to figure out the alleged assailant gained access into the building.

"It's not a building that anybody can just walk into. We have motorized gates, you have to have you know access to the gates to get into the parking lot and every entrance to the building is magnetized, therefore you have to have a key fob to gain entry," Balderrama said.