A power outage at Los Angeles International Airport diverted, delayed or canceled dozens of flights Wednesday night, and hundreds of passengers were briefly stuck on grounded aircraft.

A 2-second power "bump" shortly after 6 p.m. caused the entire airport to go dark but electrical generators kicked in and all but three terminals had power within an hour, airport spokeswoman Olga Gallardo said.

Passengers cheered when power was finally restored to Terminals 1, 7 and 8 three hours or more later.

LOOK: ROWDY PASSENGERS GIVEN JAIL TIME FOR 'FRIGHTENING' BEHAVIOR

Southwest Airlines diverted or canceled about 40 flights, spokeswoman Michelle Agnew said.

The airline said its normal schedule would resume Thursday morning.

PICS: MAN WIELDING KITCHEN KNIVES GETS TASED AT GATWICK AIRPORT

United Airlines said it delayed 19 flights, canceled two and diverted nine.

Joelle Lai, 35, was waiting in a stalled security line when she received a text message that her flight to Las Vegas was canceled.

"I should have just driven, I would have been there already," she told the Los Angeles Times.

"My latest dose of bad luck: ALL of LAX airport has lost power and my luggage is being held hostage. No air, no power, and having to siphon off my laptop's battery to keep my phone alive," a passenger tweeted. "But I'm here!"

Because electrically-powered jet bridges weren't working, hundreds of people were briefly stuck on planes on the tarmac until portable stairs were brought in to deplane them.

The outage scrambled check-in and affected everything from parking structures to cash registers at airport restaurants. The airport's signature colored pylons were also dark.

The delay in resuming power came from switching back from emergency power to the regular supply from the city's Department of Water and Power.

CLICK HERE TO GET THE FOX NEWS APP

Equipment had to be "rebooted" and checked to make sure it was working properly, Gallardo said.

"A lot of the electrical times like TSA screening, conveyor belts, everything has to be turned off and on," Gallardo said.