BEND, Ore. (AP) — A heavy equipment operator was legally justified when he shot and wounded a knife-wielding man last month outside an Oregon hotel, a prosecutor said Monday.

However, Robert Garris was foolish to appoint himself "sheriff of the Days Inn" and initiate a confrontation with the man he considered shady, Deschutes County District Attorney John Hummel said in a statement.

"Robert Garris was legally justified in shooting Christopher Nolan, which is why I did not charge him with a crime," Hummel said. "But his actions on the day of this shooting, and in the months prior, were foolish, dangerous, and mean-spirited."

Garris, 39, of Medford was staying at the Days Inn in Bend while working on a construction project. He sometimes complained to hotel staff about people on the property who looked homeless.

Rather than head back to his room or call police, Garris would go outside and confront them, authorities said.

On May 14, Garris complained to hotel staff and then found Nolan outside a restaurant next to the hotel.

When the men came face-to-face, Nolan pulled out a switchblade and extended the knife, authorities said. They say Garris stepped back, yelled at Nolan to drop the knife and then fired seven shots, four of which hit Nolan, who survived.

Oregon's self-defense law does not require people to retreat before using deadly force against someone threatening them with deadly force. For that reason, Garris — a lawful gun owner — was authorized to shoot, Hummel said.