Rail has been a hot topic in Washington this summer. In both the House and Senate, we’ve seen discussion on topics ranging from Amtrak delays to shipping concerns, and this week the Senate is holding a hearing on train safety technology. But as policymakers chart the future of the industry, some rail companies are feeling the chill of economic uncertainty and general weakness, which shows few signs of dying down. Between potential escalation of trade tensions and the prospect of new laws that will add costs to moving goods, there’s plenty for these companies, and those who govern them, to worry about.

Freight railroads are bellwethers of the broader economy, moving materials to factories and finished goods to retailers and warehouses. Like railroad shippers, rail companies are responsible for building and maintaining their own facilities. They stand to lose market share when rules slow the adoption of new technologies that could allow them to do their jobs better. When railroads are less efficient than technology allows, some track-building investments don’t make sense, and some customers aren’t profitable to serve. The loads they’d carry go by truck on public roads, causing extra traffic. Or worse, they don’t move at all, a direct economic cost of railroad regulation.

The latest episode in rail regulation has played out this year, with many states considering whether to mandate minimum staffing levels for freight rail locomotives. While intuitively appealing, these rules were not based on any kind of safety concerns. Rather, they were just the latest move in a long-running effort to regulate the labor practices of America’s freight railroads in the name of protectionism.

In this case, policymakers proposed new labor policies to fend off the arrival of promising new rail technologies, including automation. Thankfully, the Federal Railroads Administration stepped in, preempting state staffing rules to protect interstate commerce. In other words, the FRA did its job. But the battle for the use of automated technologies in the rail sector is just beginning. Indeed, the freight-staff fight was just the first front in a larger struggle over the deployment of automated systems.

The rise of technology in modern railroading has allowed companies to safely move freight and inspect their track and equipment with fewer onboard staff than at any time in the past. Today, railroads have built the infrastructure needed to test new technologies at a massive laboratory in Colorado that will allow an already safe mode of transportation to make derailments and other equipment failures even less common as time goes on. The first American tests of fully autonomous freight trains are set to take place this month.

Much of the groundwork has already been laid. Positive Train Control systems have proliferated widely. These technologies have seen railroads invest billions of dollars in track improvements, allowing operators to know where their trains are in real time. In the short term, these improvements have increased safety and will make collisions vanishingly rare. As time moves forward, the companies will be able to use their new infrastructure to make networks more efficient and more competitive with trucks—a mode of transportation that, unlike rail, relies on public infrastructure-spending to transport goods.

But continuous safety improvements won’t come cheap—and won’t come at all if railroads face major uncertainty about whether states will intervene with legislation. Federal policymakers therefore should step in and bring clarity to the rules that frame the role of technology in railroading.

Such action should make clear that prescriptive rules based on outdated business practices are inappropriate. Instead, new rules should focus on developing standards based on demonstrated performance in the field. Additionally, they should allow the FRA greater authority to approve pilot programs for new safety technologies, with the explicit goal of ensuring that new safety-improving systems are able to roll out quickly. By demonstrating new technologies on a limited basis and grounding new rules in the facts of how they work in the field, these changes would help railroads and their federal regulators avoid the risk of new laws motivated by economic protection in the future.

The future of rail infrastructure and transportation is being decided today. As economic headwinds begin to rise, Congress should not miss its shot to consign backward state laws and protectionist labor policy to the railroad industry’s past.