Twin infants found next to railroad tracks in Massachusetts appeared to be unharmed, officials said Friday as they tried to determine who left them there and why.

The discovery in Worcester, about 40 miles from Boston, was reported early Wednesday when the engineer of a slow-moving train alerted the conductor to the babies, and the locomotive was stopped.

"I saw the little baby wave at me," the engineer, Eric Martell, told NBC Boston. "I saw his little arm, he started sucking his thumb, and I was like, 'Oh my God, there's a baby in there.'"

The infants appeared to be about 9 months old, Worcester police said in a statement, adding that the police department and the Massachusetts Department of Children and Families were investigating.

"The babies appeared unharmed," police said.

Martell said they seemed to be well-fed.

"They were left with bottles and one of them even had a little Binky," he said. "They were in a nice carriage."

The infants have been placed in the care of the Department of Children and Families, according to NBC Boston.

The twins have been identified, police said. They did not say whether the parents or guardians are suspects.

Massachusetts' 2004 Safe Haven Act allows parents to legally surrender infants that are 7 days old or younger at a hospital, police station or fire station without facing criminal prosecution.

Georgeanna Broadard, who lives near the tracks, said she believes a nearby church would have accepted the children.

"There's a church right there," she told NBC Boston. "If they knocked on the door, somebody would have helped her. I just think it's sad. They're babies."