A boy who lost his leg and part of his pelvis after a tree fell on his tent during a camping trip at a public park will receive $47.5 million from a California municipality and utility in a lawsuit settlement, an attorney said Wednesday.

Zachary Rowe was a 12-year-old camping with his family in San Mateo County Memorial Park in 2012, when a rotten 72-foot-tall tanoak tree fell and crushed his tent while he slept. Doctors determined the only way to save his life was to amputate his right leg, buttock and pelvis. He underwent 30 surgeries and initially spent six months in a hospital.

San Mateo County and its contractor, Davey Tree, will pay $30 million to settle the case, while a contractor for Pacific Gas & Electric Co., Western Environmental Consultants, will pay $17.5 million, attorney Tim Tietjen said.

The boy sued San Mateo County, alleging a dangerous condition of public property and negligence by Davey Tree, which the county had hired in 2007 to inspect its campsites for hazardous trees. He also sued PG&E and its vegetation-management contractor, WECI, for negligence in failing to maintain the area around its power lines.

Each defendant requested the court dismiss Zachary's case without trial and the county and PG&E took their arguments to the Court of Appeal, which ruled neither were immune from suit, Tietjen said. He said the cases established groundbreaking decisions protecting recreational users.

"This hard fought victory on behalf of our client will help improve safety throughout California's campgrounds and public spaces," Tietjen said in a statement.

PG&E is facing dozens of lawsuits from people affected by wildfires in Northern California that fire officials said started after its power lines came into contact with trees.

In the case of the fallen tree, company spokesman Keith Stephens noted the settlement was entirely funded by the contractor's insurers.

"The incident occurred on county-owned property and the tree did not fall on any PG&E facilities," he said in an email.

A spokeswoman for San Mateo County, which will pay $24 million, referred questions to lawyer Dennis J. Ward. Ward said the county had a viable defense but agreed to settle instead of going to trial.

"We are satisfied with the outcome," he said.