The Southern California man charged with shooting and killing a protected mountain lion this summer has been sentenced to 30 days in jail and was ordered to serve 240 hours of community service in an animal shelter after pleading guilty, prosecutors said on Thursday.

Alfredo Gonzalez, 60, of Simi Valley, Calif., will have to serve the community service at a Los Angeles County animal shelter, Senior Deputy District Attorney Karen Wold in Ventura County told Fox News.

Gonzalez will have to pay restitution that will include the cost for the collar he removed, which will be more than $2,300, Wold confirmed.

CALIFORNIA MAN CHARGED WITH FATALLY SHOOTING PROTECTED MOUNTAIN LION

Gonzalez was also placed on three years of probation and the rifle he used to shoot the mountain lion was declared a nuisance by the court and ordered to be destroyed, according to the District Attorney’s office.

“The weapon that was used was also ordered destroyed and that means it will never be used again to kill another animal,” Wold told Fox News.

Gonzalez admitted to shooting the collared mountain lion known as P-38 in the head after National Park Service biologists discovered the lion's body in the Simi Valley area.

“The National Park Service got a mortality signal from the collar indicating that the lion was dead and they eventually went out to the location where the signal stopped and recovered the collar and discovered that it had been cut,” Wold told Fox News last month. “That’s when the Department of Fish and Wildlife started their investigation and after they located the mountain lion, they contacted our office.”

The male lion was born in 2012 and was collared four years ago, she said, adding that he mainly roamed areas of the Santa Susana Mountains and the Santa Monica Mountains.

It is illegal to kill a mountain lion in California without a permit, but there are some exceptions. Wold said mountain lions are on the verge of becoming endangered in California.

Gonzalez had been charged with two misdemeanor counts, one for the unlawful taking of a protected mammal and one for vandalism of National Park Service property over the cutting of the lion’s collar, which Wold said was “very sophisticated” and is worth more than $2,300. The collar maintained data on the mountain lion.

MOUNTAIN LION SPOTTED PROWLING CALIFORNIA NEIGHBORHOOD PROMPTS WARNING

Gonzalez’s attorney, Shanit Frydman, did not immediately respond to Fox News’ request for comment.

Wold said Gonzalez’s lawyer told the court that he was concerned for the safety of the livestock on the property and for the campers that were present for the summer camp session and that is why he felt compelled to shoot the animal.

“Unless the mountain lion is actually in the act of attacking, you can’t shoot a mountain lion in California without a permit,” Wold said.

She added that the Department of Fish and Wildlife did not think the shooting was justified.

“The mountain lion was not in the act of attacking Mr. Gonzalez or his livestock or any student on campus and therefore, he needed a permit to shoot it,” Wold said.

He is expected to begin his jail sentence on October 25, followed by 30 days of work release and then 240 hours of community service.

CLICK HERE FOR THE ALL-NEW FOXBUSINESS.COM

“Because the defendant took early responsibility for his actions and has no prior criminal history I think it [the sentence] is fair and reasonable on the part of the court," Wold said. "I think that this particular case is a great deterrent that will send a message to anyone who would want to kill a protected mountain lion.”