BILLINGS, Mont. — Workers have repaired a failed gate that releases water from a southern Montana dam, restoring water flow to a river known for its high-quality trout fishing, said dam operator NorthWestern Energy.

The gate that lets water out of Hebgen Dam just west of Yellowstone National Park malfunctioned and caused flows into the Madison River to plummet early Tuesday morning, the utility said. The gate was repaired just before midnight Wednesday and water flows were being restored.

The gate failure resulted in side channels of the river being cut off from the main stem, stranding some fish. There was concern that exposed trout eggs could perish, fly fishing shop owner Kelly Galloup said Wednesday.

The Madison is a highly regarded “blue-ribbon” trout fishery that flows out of Yellowstone National Park in Wyoming and eventually feeds into the Missouri River. Hebgen Dam is used to control water flows for downstream hydroelectric plants.

Volunteers on Tuesday began scooping fish out of the channels and returning them to the main stem of the river. That work continued Wednesday, and Montana Fish, Wildlife and Parks officials closed fishing along the upper river until full flows can be restored.

“We scooped yesterday all day on the upper river,” Galloup said Wednesday. “We’re just concentrating on the side channels, trying to rescue whatever we can find.”

More than 100 volunteers took part in the effort to save the stranded fish, using nets to catch thousands of them so they could be transferred to the portion of the river that was still flowing, said Morgan Jacobsen, a spokesperson for Fish, Wildlife and Parks.

“The turnout was huge,” said Chris Bianchi, who works at Galloup’s Slide Inn fly-fishing shop. “There were people everywhere that there was a side channel.”

Most of the fish saved were sculpin with a small number of trout, Jacobsen said.

How much damage was inflicted on the fishery won’t be known until possibly next year, when biologists will be able to get a better gauge of how much the low water impacted trout spawning areas, Jacobsen said.