An engineer had been sending text messages seconds before his commuter train failed to stop at a red light and collided head on with a freight train in a Los Angeles suburb last year, federal investigators said Tuesday.

Investigator Wayne Workman also told the National Transportation Safety Board on Tuesday that Robert Sanchez, the engineer of the Metrolink train, was going to allow a railroad fan to operate the train that evening.

The investigation revealed that Sanchez had sent and received 57 text messages while on duty.

One message was sent 22 seconds before the train slammed into the Union Pacific freight train near Chatsworth, Calif., killing 25 people and injuring 135 others.

Workman said all evidence about the crash was consistent with the engineer failing to stop at a red signal.

On the day of the crash, Sanchez was going to allow a person, considered a railroad fan, into the cab to run the train in the evening between four stations, according to the texts.

"I'm gonna do all the radio talkin'…ur gonna run the locomotive & I'm gonna tell u how to do it," Sanchez wrote in one text.

The texts revealed that Sanchez, contrary to company policy, had allowed unauthorized individuals into the locomotive cab three days before the accident, including one who was allowed to sit at the controls while the train was operating.

Following the crash two teenage train buffs told KCBS-TV that they received a text message from Sanchez minutes before the crash.

Investigators also found that the conductor of the Union Pacific train also received and sent numerous text messages while on duty.

The conductor also tested positive for marijuana, but he was not driving the train at the time of the crash.

With files from the Associated Press