New Jersey Transit service was back on track at around 4:30 p.m. on Thursday after a power failure snarled the morning commute.

Around 9 a.m. on Thursday, there was a power failure in one of the tunnels connecting New York to New Jersey. Two trains -- one on the Northeast Corridor Line and one on the Montclair-Boonton Line -- were stuck inside the tunnel when the power went out, and two more Northeast Corridor trains were stuck outside the tunnel.

Passengers on the trains stuck in the tunnel were pulled into New York by an Amtrak rescue engine, The Star-Ledger reported. Passengers on the trains stuck outside the tunnel were transferred to other trains after one-and-a-half hours.

For several hours following the power failure, Midtown Direct trains were rerouted to Newark and Hoboken, from which passengers could take the PATH train into Manhattan. PATH cross-honored NJ Transit tickets until normal service was restored.

Commuters took to Facebook and Twitter en masse to complain.

Wow New Jersey Transit... You have outdone yourself in stupidity, one wrote. And later: Yeah, it canceled all my fuzzy feelings of 'man I don't know why anyone bashes NJT, they've never been late for me.' It's kind of like moving in with someone who causes you to have Stockholm syndrome: 'it was nice while it lasted.'

This is the second time in less than two months that an NJ Transit train has gotten stuck in one of the Hudson River tunnels and shut down service. Around 8 a.m. on Aug. 9, the last two cars of a Northeast Corridor train derailed in the tunnel, causing service to and from Penn Station to be suspended for the entire day.