A Maryland prison inmate was nearing the end of his sentence and on a work detail last week when he attacked a corrections officer, carjacked a motorist, and led police on a long chase, authorities said. He finally crashed into a tree and was arrested.

The inmate, identified as Larry J. Johnson, 37, was approaching the end of a 20-year sentence when the episode unfolded Sept. 4 according to the Maryland Department of Public Safety and Correctional Services.

Johnson, a minimum-security inmate, was on Interstate 68 in Garrett County as part of a work crew detail from the Western Correctional Institution when he entered a prison van and began attacking the corrections officer who was behind the wheel, the state police said.

The officer, Robert E. Goss, Sr. 47, was stabbed “multiple times” with a pair of pliers, the state police said. As Goss, who had pepper spray, tried to defend himself and subdue the inmate, Johnson reportedly tried to drive off in the van, the state police said.

However, they said, the van and its attached trailer jackknifed.

At this point, police said, Johnson ran to the side of the interstate and flagged down a car driven by a 22-year-old man from Morgantown, W.Va., identified as Alan M. Gnegy.

Police said Johnson apparently stabbed Gnegy in the head with the same pliers used in the attack on the corrections officer. Then, police said, Johnson drove off in Gnegy’s Mitsubishi Lancer.

According to the police account, Gnegy said he had stopped because he thought someone needed help.

A lookout was issued for Gnegy’s car, and it was spotted by a trooper, who tried to stop it near Bittinger, Md. on State Route 495.

But the car did not stop, touching off a pursuit, which went on for about 12 miles before ending in the Sky Valley area when the car apparently went out of control and struck a tree, police said. Johnson was arrested “without further incident,” the police said.

Authorities said the corrections officer was admitted to a hospital for treatment of stab wounds. They said Gnegy was admitted to the same hospital.

Johnson did not require treatment after the car crash, the police said.

The corrections department said the inmate had been sentenced for carjacking and a handgun violation.