The Department of Homeland Security has been ordered by a federal district court in Nebraska to cease assessing fines against Union Pacific and seizing its rolling stock following discovery of illegal narcotics on trains originating in Mexico and delivered by Mexican railroads to UP at the Mexican border.

The court said U.S. Customs and Border Protection — an agency of the Deparatment of Homeland Security — exceeded its authority in assessing the fines and seizing the railcars in which the illegal narcotics were found.

UP, which sued the federal government, said it had been wrongly assessed more than $37 million in fines and penalties by Customs and Border Protection after the illegal narcotics were found in rail equipment delivered to UP at the Mexican border crossings at Brownsville, Texas, Calexico, Calif., and Nogales, Ariz. The court cancelled the $37 million in fines and penalties.

Earlier this year, UP agreed to spend some $50 million to improve its border- crossing security, and to work more closely with Customs and Border Protection. UP has assigned railroad police, K-9 teams and private security contractors to its border crossings in an effort to find those narcotics when the railcars are delivered by the Mexican railroad. UP also paid to construct an office and observation towers for use by Customs and Border Patrol officers.