TUOLUMNE CITY, Calif. — Hundreds of firefighters were digging trenches, clearing brush and starting back blazes to keep a wildfire raging north of Yosemite National Park out of several mountain hamlets.

Inaccessible terrain, strong winds and bone-dry conditions have hampered their efforts to contain the Rim fire, which began Aug. 17 and has grown to become one of the biggest in California history.

Firefighters were hoping to advance on the flames Monday but strong winds were threatening to push the blaze closer to Tuolumne City and nearby communities.

“This fire has continued to pose every challenge that there can be on a fire…,” said Daniel Berlant, a spokesman with the California Department of Forestry and Fire Protection. “It’s a very difficult firefight.”

The fire has consumed nearly 225 square miles of picturesque forests. Officials estimate containment at just 7 percent.

It continues burning in the remote wilderness area of Yosemite and is edging closer to the Hetch Hetchy Reservoir, the source of San Francisco’s famously pure drinking water, park spokesman Tom Medema said.

Despite ash falling like snowflakes on the reservoir and a thick haze of smoke limiting visibility to 100 feet, the quality of the water piped to the city 150 miles away is still good, say officials with the San Francisco Public Utilities Commission.

The city’s hydroelectric power generated by the system has been interrupted by the fire, forcing the utility to spend $600,000 buying power on the open market.

Park employees are continuing their efforts to protect two groves of giant sequoias that are unique to the region by cutting brush and setting sprinklers, Medema said.

On Sunday, crews worked furiously to hold a line near Ponderosa Hills and Twain Hart, miles ahead of the blaze. But officials warned that the fire was so hot it could send sparks more than a mile and a half out that could start new hot spots.

“We’re facing difficult conditions and extremely challenging weather,” said Bjorn Frederickson, a spokesman for the U.S. Forest Service.

The blaze sweeping across steep, rugged river canyons has rapidly expanded, thanks in part to extremely dry conditions caused by a lack of snow and rainfall this year. Investigators are trying to determine the cause of the fire, which began days before lightning storms swept through the region and sparked other, smaller blazes.

The fire is the most critical of a dozen burning across California, officials say. More than 12 helicopters and a half-dozen fixed wing tankers are dropping water and retardant from the air, and 2,800 firefighters are on the ground.

Statewide, more than 8,300 firefighters are battling nearly 400 square miles of fires. Many air districts have issued health advisories as smoke settles over Northern California. While Yosemite Valley is clear, the Lake Tahoe basin is thick with smoke, and many outdoor activities have been canceled in Reno, Nev.

The U.S. Forest Service says about 4,500 structures are threatened by the Rim Fire. Berlant said 23 structures were destroyed, though officials have not determined whether they were homes or rural outbuildings.