One of the Southern California wildfires threatened the Ronald Reagan Presidential Library on Wednesday — but the flames were kept a safe distance away thanks to the help of a buffer zone created by goats.

The Simi Valley blaze erupted before dawn and expanded to more than 1,300 acres — fed by ferocious Santa Ana winds of up to 68 mph.

Roughly 26,000 residents from 7,000 homes were told to evacuate as an army of firefighters and emergency responders fanned the area to help protect the jeopardized structures, including the famed library.

In addition to the safety provided by smoke eaters, the library has fireproof vaults to protect its historic holdings, including the presidential archives. The graves of Reagan and his wife, Nancy, are also on library grounds.

But perhaps the most valuable defense was offered before the fire erupted, when goats were brought in — as they are annually — to chew up the brush surrounding the library, creating a firebreak.

The official cause of the blaze hasn’t been determined, but Southern California Edison filed a report with the state to say it began near its power lines.

The wildfire is one of several currently wreaking havoc in the Golden State.

As of Tuesday morning, 11 significant active fires were ongoing in the state — including the Tick, Getty and Saddleridge fires in Los Angeles County, and the massive Kincade Fire in Sonoma County.

With Post wires