NJ Transit's ridership declined 3 percent last year, reflecting the impact of a major crash, a string of derailments and an agency struggling to maintain a consistently functional level of service.

Combined with the effect of low gas prices and competition from ride-sharing services, NJ Transit was down 7.8 million passenger trips last year as more and more commuters stayed off trains and buses.

The agency blamed low gas prices.

"The decline in ridership NJ TRANSIT experienced is primarily indicative of the ongoing nationwide trend due to inexpensive gasoline prices," NJ Transit spokeswoman Nancy Snyder said.

NJ Transit tallied 265 million passenger trips in the fiscal year that ended July 31, the lowest number since the 261 million trips recorded in the year that ended July 31, 2013, which included Superstorm Sandy. The October 2012 storm crippled the system for weeks.

The most recent year included the deadly train crash at Hoboken Terminal in September 2016, as well as three derailments between March and July at New York's Penn Station.

It also includes a worsening problem of trains canceled due to a shortage of locomotive engineers. The agency has begun to address the crunch, but it may have helped drive some passengers away.

"It doesn’t take much to get people to say 'To heck with this, I’m not taking that trip,'" said Jon Carnegie, executive director of the Alan M. Voorhees Transportation Center at Rutgers University.

MORE CARS:Economy, gas prices putting more cars on the road

TRAIN SAFETY:Feds give NJ Transit green light to test system to prevent crashes

STAFF TURMOIL:NJ Transit's finance chief leaves for MTA amid agency staffing crisis

But the decline also closely tracks a nationwide trend of declining transit use.

According to the American Public Transportation Association, U.S. transit ridership fell 2.88 percent in the first six months of 2017, almost identical to the 2.9 percent annual decline at NJ Transit.

"Public transit ridership is declining in almost every major urban area," said Robert Puentes, president and CEO of the Eno Center for Transportation, a Washington-based policy organization.

Washington's Metro system, rail and bus, posted a 3.6 percent decline in the first six months of the year. Ridership on Boston's MBTA declined 3.1 percent. Philadelphia's SEPTA declined 3.9 percent. New York City Transit fell 2.2 percent.

"Transit nationally is in a soul-searching stage," Carnegie said.

NJ Transit's ridership dip is the latest blow for an agency that's losing personnel to other transit agencies, is under close scrutiny from federal regulators and state lawmakers and is behind on meeting a 2018 deadline for installing a crash avoidance system.

The loss of ridership cost the agency more than $5.7 million in revenue for the year.

"People need reliability in their commuting," said state Sen. Bob Gordon, D-Fair Lawn. "They’re finding that they can’t rely on the state’s mass-transit system."

INVESTIGATION:NJ Transit facing staffing crisis that could mean more delays

FINANCIAL WOES:NJ Transit spent millions on empty office space

GOING DARK:'Gold standard' no more, NJ Transit's display board is going dark

Other culprits

According to the Federal Transit Administration, transit ridership rises and falls with the price of gasoline. The national average price of gasoline was $2.46 a gallon Thursday, compared with $3.60 in 2012.

Also, the rise of ride-hailing services such as Uber and Lyft may have eroded some of transit's market share, though very little research exists to show it.

"The jury’s still out," Puentes said.

A survey published this month by the University of California, Davis, however, showed that Uber and Lyft could be having an impact on transit. The survey showed that ride-hailing services had led to an average 6 percent drop in transit use in major cities, mostly in bus and light rail service.

The survey found that ride hailing was a complementary mode for commuter rail, leading to a net 3 percent increase in ridership.

However, NJ Transit's yearly ridership declined in all modes, with rail falling the most, 6 percent. Light rail and bus posted smaller declines of 3 percent and 1.7 percent.

Carnegie said bus riders tend to be more transit-dependent than rail riders, for whom transit use is more discretionary.

"They have another way to travel," he said.

NJ Transit and other agencies are bracing for another looming change, a revolution in transportation from autonomous vehicles. Like ride hailing, it has the potential to either augment transit or cut into its market share.

"That is going to be a wrenching change if it occurs," Carnegie said.