A broken rail near the Westbury station caused delays to dozens of trains and some cancellations, mostly on the Ronkonkoma and Port Jefferson branches, during Tuesday’s morning rush hour, the Long Island Rail Road said.

An LIRR spokesman said there were 56 delayed trains affecting an estimated 56,000 commuters. The average delay was 18 minutes and 30 seconds. Seven trains were canceled.

The LIRR said at 11:30 a.m. that service on both branches was on or close to schedule.

Spokesman Aaron Donovan said crews first noticed the broken rail shortly after 4 a.m. and it was temporarily repaired by 7:10 a.m. However, delays continued through the morning; about 10:30 a.m., several trains on other branches also were reported as delayed, according to mta.info/lirr, the LIRR website.

advertisement | advertise on newsday

Donovan said that once rail traffic subsided in the late morning, crews would be dispatched to make a permanent repair. “It should not affect the evening rush hour,” Donovan said.

The LIRR said in an email alert about 6 a.m. that crews were making repairs but that customers should anticipate delays.