Power was nearly restored to all of storm-battered Waldo County Monday night when a fallen tree plunged five towns back into darkness for more than 3 hours.

The temporary setback came as crews were working to return power to the remaining customers who had lost it after last week’s major storm, which knocked out power to half a million Mainers at its peak, according to Central Maine Power.

An estimated 5,300 customers in Frankfort, Prospect, Winterport, Stockton Springs, and Searsport again lost power from about 6 p.m. to 11 p.m., according to a CMP spokeswoman Gail Rice.

“We had just about wrapped it up back there. We were so close,” Rice said Tuesday afternoon. “It was, well, discouraging.”

The outage was not related to efforts to restore power, but occurred when a tree fell on a major transmission line that feeds power to smaller lines throughout the county, she said.

The fallen tree was likely damaged in last week’s storm, Rice said.

As of Monday afternoon, fewer than 5 customers were without power in Waldo County, according to CMP’s website.