A farmer was working on the rear of the machine when the door failed and slammed shut, catching him inside with the mechanism running. ((CBC))

A P.E.I. farmer trying to repair a baling machine was killed Tuesday when it malfunctioned and drew him into the mechanism, occupational health and safety officials said.

Allan Turner, 52, of Winsloe South, north of Charlottetown, was working alone at the back of a round hay baler at about 3 p.m.

He had the rear door held open, said George Stewart, director of the Workers Compensation Board of P.E.I.'s occupational health and safety division.

"For some reason, that door failed and it would appear that one of the hydraulic hoses failed, thus engaging the mechanism inside the round baler, pulling the gentleman into the equipment and fatally injuring him," Stewart said.

He said it appeared Turner was trying to fix something in the machine, but the power had been left on.

Stewart said Turner's wife found him in the yard when she arrived home.

Island EMS, RCMP and the North River Fire department responded to the accident, but the farmer died on the scene.

An autopsy was scheduled for Wednesday.

Stewart said it is vitally important that farm machinery be turned off before any attempt is made to make repairs.