Darien Greenwood, the man fatally shot by two St. Tammany Parish Sheriff’s Office deputies Tuesday, served almost four years in prison for the violent 2007 beating and robbery of a man in the Kisatchie National Forest, a crime with elements similar to the chain of events that resulted in his death.

In the earlier crime, which stemmed from a dispute between Greenwood and another man over a cellphone, Greenwood was accused of beating the victim with the butt of a rifle and then stabbing him in the forehead and the hand, according to a narrative of the case in court records. He also was accused of firing an AR-15 round into the ground in an effort to frighten the victim, the records show.

A co-defendant testified that he begged Greenwood to stop but that Greenwood refused and said they had to kill the victim and get rid of his body.

Greenwood was convicted of armed robbery and aggravated second-degree battery in 2010, according to Angela Whittaker, a spokeswoman for the Louisiana Department of Corrections. He was given concurrent 10-year sentences for the crimes but was released in May 2011 after serving less than four years; he had been in jail since his November 2007 arrest.

Greenwood’s Facebook page said he was in the Army until 2007, though a message left with the Army public affairs office was not returned.

The use of a knife in the earlier incident is similar to what St. Tammany Parish Sheriff Jack Strain said happened Tuesday northeast of Mandeville when deputies, tracking Greenwood in connection with a home burglary around midday, found him hiding near a “pile of debris” on Armel Road just north of Interstate 12.

When the deputies approached the hiding place, Greenwood tried to stab one deputy, Strain said. At that point, a police dog named Thor — a 4-year-old, 80-pound Belgian Malinois — attacked Greenwood, and Greenwood stabbed the dog in the neck and shoulder.

Two deputies, including Thor’s handler, then shot Greenwood, who was pronounced dead a short time later at North Oaks Medical Center in Hammond.

An autopsy was conducted Wednesday, but results have not been released.

Both deputies have been placed on leave while the investigation continues. Their names have not been released.

Wednesday afternoon, Thor was recovering from morning surgery at a local clinic where veterinarians worked Tuesday night to stanch his bleeding and stabilize him after he lost a lot of blood. Strain said he is hopeful that Thor will make a full recovery and return to duty.

This wasn’t the first attempt on Thor’s life. Last year, he helped deputies track down a man who had become known on social media as the “Spiderman Burglar.” In an attempt to escape capture, that man, Joshua Edward Green, leapt into the Bogue Falaya River, pulling Thor with him and trying to drown the dog. Thor’s handler followed the man into the water and was able to subdue Green and rescue the dog, Strain said at the time.

Tuesday, it was Thor leaping to the aid of his handler, Strain said.

Tuesday’s incident began when a resident reported that she returned home about 12:30 p.m. and saw two men leaving her house with some of her possessions. The woman was able to give deputies a description of the burglars’ car, which was spotted moments later on La. 59 just north of I-12. When deputies tried to pull the car over, two men fled on foot.

One man, Dean Perkins, 22, of Covington, was caught within minutes. He has been booked on a single count of simple burglary of an inhabited dwelling.

Perkins and Greenwood had the same home address, public databases show. Perkins has previous arrests in St. Tammany on burglary, theft and drug possession counts, records show.

Greenwood fled south into a wooded area, prompting a four-hour search that ended when Thor alerted deputies to Greenwood’s hiding place behind the debris.

Advocate staff writer Sara Pagones contributed to this report. Follow Faimon A. Roberts III on Twitter, @faimon.