The Greek government was supposed to install a safety system nearly three years ago that was designed to prevent the kind of head-on train collision that resulted this week in the worst railway disaster in the nation’s history.

As a freight train and a passenger train barreled toward each other at high speeds on the same track late Tuesday night, railway officials had to rely on a system that was far less sophisticated than those used in many other European countries, according to railroad and union officials and records.

But even that more rudimentary system was not fully operational, with lights and signals out of service, union and safety officials said on Thursday as Greek investigators searched for more bodies amid the wreckage.

That confluence of delays, warnings and mistakes left Greece’s busiest rail corridor vulnerable to what every safety system is designed to prevent: human error.

Much of what happened leading up to the crash, which killed 57 people, remains unclear. But officials and experts agreed on one thing: If a modern safety system had been in place as planned, it would have been all but impossible for a freight train to end up on the same track as a crowded passenger train.

Warnings would have sounded, and automatic brakes would have kicked in. “Yes, certainly so,” said Josef Doppelbauer, the head of the European Union Agency for Railways, which has warned for years of significant inadequacies in Greece’s railway safety system.

The Greek prime minister, Kyriakos Mitsotakis, blamed the crash on “tragic human error.” The transportation minister resigned, acknowledging that efforts to improve rail safety had been inadequate. And the station manager in Larissa, a city near the crash site, faces charges including manslaughter through neglect.

But the crash shines a light on systemic problems that go beyond whatever mistakes were made this week.

Greece’s rail system consistently ranks among the continent’s most dangerous despite receiving $700 million in modernization money from the European Union over the past decade. And the installation of the new safety system became so bogged down that a senior government official quit last year to protest what he called “unjustifiable delays.”

The European Union expects its 27 member countries to put in place sophisticated new procedures known as the European Train Control System by the end of the decade. That system monitors trains and takes control when they go too fast, blow through red lights or end up on the wrong tracks. The European Union wants to expand cross-border train travel, and harmonizing safety standards across the bloc is part of that strategy.

But putting it into effect has been inconsistent, as evidenced by this week’s crash.

“If the European Train Control System would have been installed and working properly, it should have absolutely prevented something like this from happening,” said Jedde Hollewijn, the railways policy officer for the European Transport Workers’ Federation. “The intention is that all European countries implement this, and we know that Greece has been lagging significantly.”

Luxembourg, the bloc’s smallest and richest country, is already using the new system across its rails. Belgium plans to be fully operational by 2025. Others have upgraded their major routes. But even without the new technology, most rail systems have safety features to prevent head-on collisions. The French National Railway Safety Authority, for example, uses automatic braking systems and other technology.

That was not in place in Greece. The country has never had a national automated safety system, E.U. records show. And the switch system in Larissa has been inadequate for years as parts went missing from basic signaling equipment, said Nikolaos Tsikalakis, the president of the staff union of the Greek national railroad organization.

The exact cause of the slow upgrades to the safety system were not immediately clear, but union and safety officials and experts cited as factors tight budgets, supply chain problems related to the Covid-19 pandemic, bureaucratic delays and contract disputes.

Various rail union officials have written angry letters to the Greek government for years, including as recently as last month, warning about safety problems. That letter ominously warned of a tragedy and criticized Greek officials for dragging their feet.

“We will not wait for the coming accident to see them cry crocodile tears,” the letter read. “What else are they waiting for to happen to intervene?”

“We have told every government about these issues, but we have not found open ears,” Mr. Tsikalakis said. “Thus, we came to this tragic accident. I don’t want tears and blood on the tracks.”

Rail safety officials in Europe said that the Greek authorities have also neglected the critical task of monitoring and updating safety procedures and equipment across the network. That could have improved even the country’s rudimentary safety system, they said.

“Risks and monitoring assessments have to be conducted on all locations, all types of trains, all types of equipment,” said Vaibhav Puri of the Rail Safety and Standards Board in Britain.

The crash also highlights the limited power of the European Union to demand improvements from railways, even as it pours money into them. The bloc earmarked around $117 million specifically for safety upgrades on the Athens-to-Thessaloniki route, on which the trains crashed.

Mr. Doppelbauer, of the European Union Agency for Railways, said his safety organization had issued reports and called on member countries to do better but could not force national governments to make changes. By multiple standards, Greece’s was the deadliest rail system in Europe.

“We put together an action plan and asked Greek authorities to report back on the action plan,” he said. “But our powers are limited.”

He suggested that the European Commission, the bloc’s administrative arm, could take legal action against Greece for failing to maintain safety standards. On Thursday, though, European officials struck a collaborative tone. Adalbert Jahnz, a spokesman for the commission, said the bloc had financially supported Greece and remained in close contact with the authorities there.

The Greek authorities, however, have not been transparent about important railway details. Two weeks before the crash, European officials took Greece to court over its refusal to make public the key contract spelling out how the railway will be managed as it modernizes.

At a news conference on Thursday, the Greek state minister, Giorgos Gerapetritis, apologized to the families of the crash victims and promised a thorough investigation. He also vowed to modernize railway infrastructure to “restore the safety of rail travel and boost a sense of security in the psychology of citizens.”

The search operation is expected to conclude early Friday afternoon.

Mr. Doppelbauer said he hoped the tragedy would force improvements on other rail systems across Europe. “Such a catastrophic accident is always a reminder of how important safety is,” he said. “And a reminder for everyone to take the warnings seriously.”

Niki Kitsantonis contributed reporting from Larissa, Greece and Chrysostomos Trimmis from Volos, Greece.