About 2,000 homes were left without power on Thursday evening after flash floods hit Kilmarnock.
Fire appliances were used to pump water away
Engineers were initially unable to carry out repairs to restore power because of the risk posed by lightning.
Several properties were also affected, with up to two feet of water pouring into the East Ayrshire Council building and the town's Mark and Spencer store.
Strathclyde Fire Brigade said they had started taking calls from the public at about 1945 BST.
The council building in London Road was also said to have been affected by about two feet of water.
The council asked Scottish Power to cut its electricity supply as the water was threatening to get into their computer servers.
There were also reports of heavy flooding on Union Street and Lochnagar Road, although cars were said to be able to pass.
Scottish Power said the power cut was caused by lightning hitting the overhead power network.
A spokeswoman apologised for the inconvenience and said all the homes were back on by 2200 BST on Thursday.