A 54-year-old Hyattsville man is in custody after an attack on a Maryland state trooper on the Beltway early Saturday, authorities say.

A motorist who pulled over during the attack may have prevented the trooper from suffering serious injury, said state police spokesman Greg Shipley.

The man, who has not been charged, called police about 6:30 a.m. to report an accident on the inner loop near Interstate 295, Shipley said. Trooper Byron Tribue arrived within minutes to the site where the man’s vehicle had struck a guardrail.

The man approached the passenger side of Tribue’s patrol car while the trooper was inside. Tribue asked whether the man was injured, Shipley said, and the man said that he had chest pains.

Tribue turned around in his seat to retrieve his hat when the man ran to the driver’s side, pulled out a seven-inch knife and began attacking Tribue through the open window, Shipley said.

While Tribue was trying to call for help on his radio, an unknown motorist pulled over and jumped on the man’s back, allowing Tribue to escape. The motorist drove away before state and county police arrived minutes later.

Tribue suffered stab wounds to his hand and was treated at Fort Washington Medical Center and released.

The motorist may have “possibly protected Tribue from more serious injuries,” Shipley said.

The suspect was also taken to the hospital, where he was examined for chest pains and remains in custody.

Shipley said there is evidence that the suspect intended to provoke Tribue into shooting him. But police are unsure whether he staged the accident in order to attack a trooper.