The southbound CSX train, going from Saginaw to Walbridge, Ohio, went off its tracks about 1:15 a.m., according to CSX spokeswoman Jane Covington.
The engineer and conductor suffered minor injuries.
It had been raining heavily in the area, and a surge of water washed out the culvert running beneath the railbed, causing the soil and tracks to give way, said Lt. Jeremy Lintz of the North Oakland County Fire Authority.
``All I can say is, `Wow.' It's just a big mess,'' Lintz said.
Police Chief Greg Hansmeier said beavers may share the blame with the rainstorm.
``Apparently, there was a beaver dam in the area that was backing up water in a field,'' Hansmeier said. ``For whatever reason, it gave and the water rushed out.''
The torrent left water standing 2 feet deep on a road. Residents of two or three homes were evacuated but allowed to return later in the morning.
The two locomotives rolled onto their sides, one on each side of the tracks. The seven railcars immediately behind them also derailed, Lintz said. The cars carried auto parts and vehicles, he said. Fifteen undamaged cars were pulled away from the scene by another locomotive.
Some diesel fuel leaked from the locomotives, Wiegand said.
Contractors were sent to the scene with heavy equipment to start the cleanup, Covington said. She said it was too early to estimate how long that will take.
Janet Crittenden was sleeping when the train derailed near her home.
``So I didn't know what it was,'' said Crittenden, 52. ``Was I dreaming? In a half-hour, the fire department contacted us.''
Crittenden said the road to her home was washed out along with the tracks.
``It looks like a toy train someone set up,'' she said. ``The gravel and everything is gone.''
Holly Township is about 50 miles northwest of Detroit.