Maine escaped the most damaging path of the “superstorm” that ended Tuesday, but as night fell, thousands of residents remained in the dark.

As of 11:30 p.m. Tuesday, Central Maine Power Co. reported that 17,440 customers were still without power. More than 14,000 of them were in York and Cumberland counties.

CMP spokesman John Carroll said the utility hoped to have everyone’s power restored by Thursday, “and possibly sooner.”

More than 159,000 of CMP’s 615,000 customers lost power at some point during the storm, he said.

Carroll said CMP expected to have power restored to most communities north of Augusta by Tuesday night, except for some remote towns in northern Franklin County.

He said Cumberland and York counties were hit hardest by outages because they got stronger winds off the ocean and had more leaves on trees, leading to downed wires when trees or branches fell on them.

Carroll said repair crews will likely go south to places such as New York and New Jersey, which the storm hit directly, to help with those restoration efforts once the work in Maine is complete.

Carroll said the restoration effort in Maine was on target Tuesday.

“We’re recovering from what might be a once-in-a-century event. We think we had a good (restoration) plan,” he said.

SPARED SERIOUS DAMAGE

The storm brought rain, 25-foot waves and winds as strong as 76 mph to Maine on Monday and Tuesday, according to the National Weather Service in Gray. The weather service said Portland got 1.5 inches of rain.

Utilities, emergency officials and residents expressed relief that Maine escaped serious damage like that in the mid-Atlantic states.

But for Michael Gordon of Wells, the storm’s impact — and his mortality — were more apparent.

Gordon was in the bedroom of his home on Canterbury Road around 1 a.m. Tuesday when a branch of a falling pine tree punctured the ceiling, narrowly missing him.

“I’m laying in bed and I could hear the cracking. I rolled out of bed just as the branch came through,” Gordon said. “The sheetrock was blowing all over me.”

Water poured through the opening in the ceiling, soaking the floor.

The Wells Fire Department called CMP crews to remove the pine tree because it had fallen across power lines connected to the house.

Pieces of wood and tufts of fiberglass insulation were strewn across the bedroom carpet Tuesday morning. Gordon’s front yard was covered with pieces of the tree and the twisted remnants of his flagpole.

PORTS REOPEN, BARGE SINKS

As the weather cleared at midday Tuesday, some activities returned to normal.

The Coast Guard reopened the ports of Portland and Portsmouth, N.H., at 10 a.m. after closing them before the height of the storm Monday.

The worst storm-related mishap in Maine occurred when a barge in Bar Harbor sank at its mooring, said Coast Guard Lt. Nick Barrow in South Portland. The Coast Guard is working with the harbor master there to have the barge raised, he said.

Two members of the Coast Guard in South Portland will be sent to New York City to help with storm recovery there over the next four to five days, Barrow said.

All flights from the Portland International Jetport were canceled on Tuesday, though there were no problems specifically in Portland.

“The jetport itself, we’re in fine shape,” said Bob Rothbart, who works in the airport’s communications center. “The runways, everything is open, but like everything else on the East Coast, the airlines took their airplanes and sent them to safe places.”

Flights arrived at the airport Tuesday afternoon, coming from Atlanta, Chicago, Charlotte, N.C., and Detroit, where the storm had much less impact.

Travelers were urged to contact their airlines for flight-specific information.

The Amtrak Downeaster canceled Tuesday’s runs between Boston and Portland because of power outages in New Hampshire, said Patricia Quinn, executive director of the Northern New England Passenger Rail Authority.

Without power, crossing lights and barriers don’t work, so trains must go slowly and conductors must manually flag them through road crossings, she said.

“We didn’t want to have people get on and, four hours from now, we’ll get you to Boston,” Quinn said. “We didn’t want people to plan on us and not be able to rely on us.”

Quinn said the commuter train that leaves Portland at 5:25 a.m. will not run Wednesday. Instead, commuters should drive to Wells to board buses that will take them to Boston’s North Station.

The Downeaster does plan to run a train today, departing at 8 a.m. from Portland, but Quinn said that if power outages are still widespread in New Hampshire, the train will arrive late in Boston.

Riders should check Amtrak’s website for updates regarding the rest of Wednesday’s train schedule.

YORK COUNTY ‘PRETTY LUCKY’

Besides some road closures and power outages, there was little damage in the state’s southernmost county.

Steve Harding, spokesman for the York County Emergency Management Agency, said, “Overall, we got out of it pretty lucky, all things considered.”

Emergency dispatchers in York reported several roads closed because of trees downing wires, with extensive power outages.

Nathaniel Higgins, at the York dispatch center, reported early Tuesday morning that several roads were still blocked but parts of town were getting their power back.

“We were on a generator all night but we just got power back here,” Higgins said.

At Camp Ellis in Saco, Mike Otazo stood alone at the end of Lower Beach Road as the sun rose Tuesday morning.

After a windy night in his house near the ocean, he was curious to see what daylight would reveal. “I wanted to wake up and see a hurricane sunrise,” he said.

Otazo never lost power, but he said the wind was “unbelievable.”

“It sounded like my windows were going to bust out,” he said.

Sand and seaweed were left on Lower Beach Road by water that splashed over the sea wall, but there was nothing out of the ordinary after a big storm, Otazo said. A sign lay twisted at the end of the street.

On Main Avenue, Camp Ellis resident Linnea Olsen walked her two dogs, a cup of coffee in hand. She said she could hear the ocean from her home Monday night, which is unusual.

“It was roaring pretty hard,” she said. “I think we were very, very fortunate we were spared.”

Roads to Camp Ellis that were barricaded during the storm reopened by mid-morning Tuesday. Piles of sand covered the intersection of Main and North avenues, but there was no visible flooding or damage.

On the beach at end of Fairhaven Avenue, a giant protective sandbag ruptured, allowing water to flow up the street. Some of the boulders providing protection from the surf washed away.

People walking on Old Orchard Beach said they were surprised at how little debris washed up on the sand.

Scott and Jennifer Provencher of Old Orchard Beach walked the beach with their children, 5-year-old Riley and 2-year-old Vivienne.

Jennifer Provencher said she was surprised there wasn’t more debris, but was grateful that power stayed on throughout the storm.

ROADS CLEARED AND REOPENED

On Tuesday afternoon, Bill Gribbin, 72, of Littlejohn Island in Yarmouth used a chain saw to cut up branches that he found littering his yard when he returned after spending the night inland.

“Whenever the wind gets blowing, we don’t feel at peace,” he said. “We bailed out of here and went to town, where it is safe.”

On Route 88 in Falmouth, which was closed at Depot Road, crews from Time Warner Cable and CMP worked to repair equipment after a huge tree fell over and took down lines.

“What a mess,” said Colin Chase, a lineman with Time Warner. “There’s stuff everywhere.”

State police and Cumberland County emergency dispatchers reported no storm-related injuries.

Erin Pelletier, a dispatcher with the Cumberland County Regional Communications Center, said crews worked through the night to reopen major commuter routes like River Road in Windham, which was closed for downed trees and wires, she said.

“We actually lucked out I think,” she said.

Portland got through the storm without major problems, said Nicole Clegg, the city’s spokeswoman. She said there was flooding along Marginal Way at high tide around midnight, but it was not severe.

The storm also knocked down a couple of utility poles on Washington Avenue Extension and Riverside Drive, she said.

Margaret Curtis, a meteorologist with the National Weather Service, said Wednesday’s forecast calls for showers in the morning but dry conditions and mild temperatures – mid-60s — later in the day.

Curtis said the weather should be good for children who plan to go trick-or-treating Wednesday night.

– Staff Writers David Hench, Gillian Graham, Tom Bell, Dennis Hoey and Jessica Hall contributed to this report.