BATH, Maine — High tidewaters along the brackish Kennebec River collided with torrential rain early Wednesday afternoon, flooding a Central Maine Power substation across the street from Bath Iron Works and prompting CMP to cut power to the shipyard and much of Bath, Phippsburg and West Bath.

The shutdown stranded the operator of a crane at the shipyard for nearly an hour.

Acting on a phone call from city officials, CMP sent a team to the flooded substation, adjacent to The Cabin pizza shop and across Washington Street from the shipyard, CMP spokeswoman Gail Rice said. That team determined the water to be a threat to public safety.

“The flooding was getting into some of our energized equipment at the substation,” CMP spokeswoman Gail Rice said. “You don’t want to be anywhere near that.”

CMP shut off power at about 2:30 p.m., leaving the shipyard in the dark and prompting BIW to send the first shift home early and cancel second-shift workers at the main yard in Bath as well as at the consolidated warehouse and Harding Plant in Brunswick, BIW spokesman Matt Wickenheiser said.

When power at the shipyard went out, the yard was evacuated, but the operator of a crane inside one of the assembly buildings was not near enough to any of the access walkways around the building, and was stranded briefly inside the crane box.

“We’d done exercises on this scenario with [the] Bath Fire [Department], and we had them bring in their ladder truck,” Wickenheiser said. Unfortunately, firefighters discovered that without power, the electronic doors to the building couldn’t open wide enough to allow the ladder truck in.

Firefighters set up lights and shipyard officials quickly moved to a contingency plan, which included mechanically moving another crane that could be operated with wrenches, near the first crane. After the operator was secured with a safety harness, he stepped into the other crane box and descended without incident, Wickenheiser said.

Meanwhile, much of downtown Bath, Phippsburg and a few customers in West Bath were also without power — altogether about 4,000 customer accounts were affected, Rice said.

Bath Police Lt. Bob Savary said officers “scrambled a bit” to place stop signs at intersections, and the Vine Street onramp to the Sagadahoc Bridge was closed due to flooding.

By about 4 p.m., the water had receded enough that CMP restored power at the substation and started bringing customers back online — about 3,000 accounts at 4 p.m. and the last few by 4:30 p.m.

In the meantime, though, dozens of cars in the shipyard parking lot were underwater, which Savary estimated to be about 4 feet deep.

Wickenheiser said BIW offered rides home to employees who couldn’t reach their cars. He said he couldn’t estimate how much it cost BIW to shut down Wednesday.