A young Los Angeles County sheriff’s deputy was standing outside his station in Lancaster, Calif., last week when, he said, two gunshots erupted from a nearby apartment building, one of the bullets grazing him in the shoulder.

He was rushed to a hospital, and hundreds of law enforcement personnel embarked on a dayslong manhunt that diverted traffic, caused the local passenger rail system to shut down and displaced residents of the apartment building.

But it turned out that the deputy made it all up.

“There was no sniper,” Capt. Kent Wegener said at a news conference on Saturday. “No shots fired and no gunshot injury sustained to his shoulder. Completely fabricated.”

The deputy, Angel Reinosa, 21, had acknowledged lying about being shot at on Aug. 21, Captain Wegener said. Detectives had seen no visible injury to the deputy’s shoulder, and “he also had told investigators that he had caused the holes in his shirt by cutting it with a knife,” the captain said.