A blaze burning in foothills west of Yosemite National Park destroyed dozens of structures and forced thousands to flee Gold Rush-era towns but fire crews have been able to stop it from reaching a threatened community on the foothills of the Sierra Nevada. The fire was threatening about 1,500 homes and other buildings, after already destroying 29 structures. It's not clear what type of buildings burned. The flames are near Highway 49, a historical route winding its way up California foothills of the western Sierra Nevada dotted with little towns that sprouted along the gold Mother Lode that drew miners to California in the 1800s. More than 3,000 firefighters are battling the 4-day-old blaze that has scorched 75 square miles (194 square kilometers), the California Department of Forestry and Fire Protection said. The fire has forced almost 5,000 people from homes in and around a half-dozen small communities, officials said. Heavy smoke hung in the air over Mariposa, a town of 2,000 with century-old wooden buildings, including what's touted as the oldest active courthouse west of the Rocky Mountains. The fire got within a half mile of Mariposa but crews have been able to keep it out of the town, Cal Fire spokesman Jason Motta "Most of the town of Mariposa has not been affected by anything other than the smoke," Motta said. At its closest, the blaze was still about 35 miles (56 kilometers) from the boundary of Yosemite, where campgrounds are open, park spokesman Scott Gediman said. The fire closed one of several roads into the park during its busy summer season, and rangers warned visitors with respiratory problems to be mindful of the smoky haze the blaze wafted over the park's landmark Half Dome rock face, Gediman said. Among park visitors Gediman talked to, "people understand fire is a naturally occurring thing," he said. "Nobody was upset about it." Yosemite does not appear at risk from the fire, which was moving south Wednesday, away from the park, California fire spokesman Jordan Motta said. Tony Munoz, 63, and his wife, Edna Munoz, 59, were ordered out of their home outside Mariposa on Tuesday. They grabbed clothes, medicine and their three dogs and a cat before fleeing. Driving out on narrow roads clogged by others getting out, "you couldn't even see the sun" in the ash-filled sky, said Tony Munoz, a school custodian. Downtown Mariposa was empty except for firefighters and other emergency workers. Fierce flames were visible on slopes about a mile away. Record rain and snowfall in the mountains this winter abruptly ended California's five-year drought. But that has increased the challenge for crews battling flames feeding on dense vegetation. "There's ample fuel and steep terrain," Cal Fire spokeswoman DeeDee Garcia said. "It makes firefighting difficult." Statewide, about 6,000 firefighters were battling 17 large wildfires, including about 2,200 at the fire near Yosemite. Gov. Jerry Brown has declared an emergency, bolstering the state's resources to battle the fire that he said has forced thousands of residents to flee and is expected to continue burning.