BROCKTON — A veteran state trooper was killed while on a highway traffic detail in Mansfield early yesterday morning in a bizarre accident in which one alleged drunk driver plowed into another, trapping the trooper under a car as his body was dragged across the highway.

Sergeant Douglas Weddleton, a 52-year-old father of four, had parked his cruiser at the entrance to a highway exit ramp on the northbound side of Interstate 95 with his blue lights flashing to prevent traffic from entering about 1:30 a.m. when an alleged drunk driver in an Acura tried to maneuver past him, police said.

Weddleton stopped the Acura and began talking to the driver, Kenneth Weiand, a 43-year-old state probation worker. At that moment, police said, a Ford truck driven by Anthony Perry, a 45-year-old carpenter from Hyde Park who had been watching the NBA Finals at a Rhode Island bar, slammed into the Acura, police said. Perry later told police he was traveling at 65 miles per hour, according to court documents.

The force of the impact caused the Acura, with Weiand inside, to veer left, striking Weddleton and trapping the trooper underneath the car. He was dragged across three lanes of the highway, as the nearby construction workers desperately banged on the Acura’s windows, trying to get the car to stop, according to a State Police report.

Perry was arraigned yesterday on charges including negligent motor vehicle homicide and operating under the influence, and Weiand was charged with driving while under the influence of alcohol. Both men pleaded not guilty yesterday in Attleboro District Court.

Yesterday, mourners brought flowers and food to the trooper’s family at their Brockton home, where a trooper stood sentry outside to keep media away.

“He was a dedicated police officer and even more so a devoted and loving husband and a doting father to his four boys, of whom he was extremely proud,’’ said Colonel Marian McGovern, the State Police superintendent, who notified Weddleton’s family. “To see four young boys who idolized their father and to tell them their father was no longer with them will remain forever in my heart.’’

Weddleton had worked 15 years in the department’s ballistics unit, but left in 2008 to patrol highways out of the Foxborough barracks so he could spend more time with his wife and children.

Shortly before working at the roadside detail, he had attended a graduation ceremony for his youngest son. From there, he rushed straight to the road construction site in Mansfield.