TAUNTON, Mass. — The death of a man who was hit by a train in Taunton has been ruled a homicide after an autopsy revealed he died of gunshot wounds.

The Bristol County district attorney said an autopsy by the state medical examiner’s office concluded that 24-year-old Edwin Rivera Jr. of Taunton died of bullet wounds.

Authorities had been investigating the death since getting a call late Monday about a man struck by a CSX train behind a business on Cushman Street.

Police arrested 21-year-old Flavio Daveiga on Wednesday and charged him with accessory to murder before the fact and the obstruction of justice portion of the witness intimidation statute.

Daveiga was ordered held on $2 million cash bail and is due back in court for the appointment of counsel on Dec. 3.