Sonny Gilligan learned the hard way that an old dog actually can learn new tricks — like how to fire a shotgun from the back seat of a pickup truck.

Gilligan, of New Mexico’s Doña Ana County, was shot in the back while sitting in the front seat of his parked pickup truck during a hunting trip for jackrabbits with his three dogs — Charlie, Scooter and Cowboy — west of Las Cruces on Thursday, the Las Cruces Sun-News reports.

“Charlie got his foot in the trigger of the gun and I leaned forward and he slipped off the seat and caught the trigger — and it shot,” Gilligan told the newspaper. “It was a freak accident but it’s true, that’s what happened.”

The shotgun fired by Charlie, a 120-pound Rottweiler mix — or, presumably, a “Shot-weiler” — blasted through the driver’s seat and entered Gilligan’s back, breaking several ribs and his collarbone. He was lucky to survive the freak accident, he said.

“I was very fortunate I could get to my phone,” Gilligan told the newspaper. “The [Doña Ana County Sheriff’s Office] first responders saved my life. If they waited 10 more minutes, I would’ve died. I lost so much blood. I know I actually passed to the other just before getting to the hospital but they were able to revive me through CPR and bring me back.”

Deputies and state police officials found Gilligan, 74, next to his truck after the shooting near County Roads B4 and B5. He was transported via helicopter to a hospital in El Paso, where he underwent several surgeries but is expected to fully recover, the newspaper reports.

Gilligan, who goes by the name Tex, did not return messages seeking comment. He was scheduled to be transferred to a rehab facility in Las Cruces on Wednesday.

The three dogs, meanwhile, were sent to “jail” after the incident — the Animal Service Center of the Mesilla Valley, Gilligan joked.

“It was an accident, although they tease me, asking me if he did it on purpose,” Gilligan told the newspaper. “Truth is, he’s a big, loving dog and would never hurt anybody on purpose.”

All three dogs were rescued by Gilligan when they were puppies. Charlie the Rottweiler was even picked up for free in El Paso, he said.

But the accidental shooting didn’t come as a shock to Gilligan’s son, who said the adopted pooches are known to be rowdy.

“They’re pretty rambunctious and full of energy,” Mark Gilligan said. “That’s why the owners gave them up. My dad has four acres of land so they can run free. So it didn’t surprise me at all. When they see a cow or other animals, they want to jump in the front.”