Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

LOS ANGELES — One of the worst droughts in California history has officially ended, Governor Jerry Brown declared on Friday, but not before it strained the state's farm economy and threatened water supplies for millions of residents.

Months of drenching storms and melting snowpack have replenished reservoirs, which began drying up in late 2011. That allowed Brown to lift most stipulations of an emergency order he implemented in January 2014, about two years after the conditions crossed the line into drought.

Brown also said the need for conservation continued. Officials will still require some long-term water-use limits imposed last year and are developing water preservation standards for urban agencies.

"This drought emergency is over, but the next drought could be around the corner," Brown said in a statement. "Conservation must remain a way of life."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The drought cost the agricultural economy billions, killed an estimated 100 million trees, led a half-million acres of farmland to be fallowed and deprived some communities of reliable sources of drinking water.

In April 2015, when the state's snowpack hit its lowest since 1950 at 5 percent of its historic average, Brown stood on a dry mountain that was normally blanketed in snow at that time of year and ordered urban areas to reduce water use by 25 percent. As of last week, the snowpack stood at 150 percent of normal.

The 2015 order led environmentalists to complain that the state, which leads the nation in production of fruits and vegetables, did too little to force farmers to conserve water. For their part, farmers said they received far less water than promised by state and federal authorities.

Ranch hands drive cattle against the backdrop of hills covered in blue, yellow and orange wildflowers fed by a rainy winter on April 6, 2017, at Carrizo Plain National Monument near Taft, California. ROBYN BECK / AFP - Getty Images

On Friday, the Democratic governor lifted the drought declaration in all counties except four, mostly in the state's agricultural Central Valley.

"It's worth taking a moment to be grateful for all the rain and snow out there," Felicia Marcus, chair of the State Water Resources Control Board, told reporters on a conference call after the governor's announcement.

California officials have credited residents for doing their part to conserve water by taking shorter showers and ripping out grass lawns to install landscaping that requires minimal irrigation, among other measures.

Even though the drought is officially over, groundwater supplies remain below normal, the Natural Resources Defense Council cautioned in a statement.

"Year after year, California continues to use more water than is made available by nature," Kate Poole, director of the group's water and wildlife project, said in a statement.