Media playback is unsupported on your device Media caption The fire is raging out of control

A huge California wildfire has burned into Yosemite National Park, park officials say.

The week-old Rim Fire grew to 164 sq miles (424 sq km) by Friday morning, and had burned 17 sq miles at the edge of the park by the afternoon.

The blaze has forced scores of tourists to flee during peak season and is threatening thousands of homes.

More than 2,000 firefighters have been tackling the flames in difficult terrain. It is just 2% contained.

California Governor Jerry Brown has declared a state of emergency for San Francisco 150 miles away as the blaze is threatening power lines that bring electricity to the city.

Two of three hydroelectric power stations serving the city have been shut down.

The city's water supplies could also be hit if a reservoir, four miles from the fire, is affected.

'One of the worst'

The blaze has reached Yosemite's backcountry at Lake Eleanor, which is accessible by hiking trails, park spokeswoman Kari Cobb told the Associated Press news agency.

We've got a monster on our hands Lee Bentley, US Forest Service

"It's not a very visited part of the park, even though it is very beautiful," she said, adding the fire was some 20 miles away from Yosemite's main tourist area.

Ms Cobb said the park service was "not anywhere near" to closing the attraction.

The blaze has shut a stretch of motorway that is one of three entrances to the west side of the park, which receives up to 15,000 visitors a day in the summer.

The Rim Fire is one of 50 major wildfires burning in the western US.

The blaze began a week ago in Stanislaus National Forest, west of Yosemite, and has so far destroyed only a handful of homes and outbuildings.

But a spokeswoman for the US Forest Service said 4,500 homes, hotels, businesses and several campsites were under threat as of Friday, up from 2,500 the day before.

Evacuation advisories have been issued to nearby communities.

Image caption The rapidly spreading Rim Fire has now reached Yosemite National Park. Image caption More than 2,000 firefighters are tackling the blaze. Image caption A resident walks a horse down a deserted street after the neighbourhood was evacuated. Image caption This firefighter is lighting a smaller fire, intended to act as a control line by burning up fuel for the main fire. Image caption Smoke is seen through the windows of a property. Several thousand homes are threatened by the flames. previous slide next slide

Officials went door-to-door in Pine Mountain Lake, an area normally teeming with tourists.

"This fire, it's killing our financial picture," restaurant owner Corinna Loh told the Associated Press. "This is our high season and it has gone to nothing. We're really hurting."

Lee Bentley of the US Forest Service told CBS News earlier this week: "We've got a monster on our hands. This fire is making its own weather.

"It's going every which direction. This is one of the worst I've ever been on. I've been doing it for quite a few years."

The area's steep hills and rugged terrain are hampering firefighters' efforts, officials say.

The 'Beaver Creek' fire in Idaho has destroyed some 45,000 hectares near the ski resort of Sun Valley.

Meanwhile, five wildfires in Yellowstone National Park have scorched about 18 square miles of mostly remote areas.