Two passenger trains crashed head-on in Indonesia early Friday, killing at least five people and leaving many others injured, a railway official said.

Rescuers were still trying to reach several people trapped inside the crumpled carriages hours after the crash.

The accident occurred at around 2:30 a.m. on the outskirts of Banjar, a village in West Java province, 170 miles (270 kilometers) from the capital, Jakarta.

"We don't know why they were on the same track," said Bambang Ervan, a spokesman for the Transportation Ministry. "We're still investigating."

He said a passenger train traveling eastward from the city of Bandung collided with a westbound train from Surabaya.

Railway spokesman Bambang Supriyanto said at least five people were killed and 21 others were hospitalized, some in critical condition.

Phone calls to police and hospital officials went unanswered early Friday.

Train accidents are common on Indonesia's aging railway network, especially at crossings.