Madison is the most secure place to live in the United States among large metropolitan areas (500,000 residents or more), according to the seventh annual Farmers Insurance study.

The Wisconsin state capital was ranked third last year. This is the fifth time out of seven years Madison has placed in the top 20.

The rankings were compiled by www.bestplaces.net.

Factors used to determine how secure a metro area is included crime, extreme weather, risk of natural disaster, housing depreciation, foreclosures, terrorist threats, environmental hazards, air quality, life expectancy and job losses.

According to the news release from Farmers Insurance, Madison moved up to No. 1 due to a low unemployment rate, low violent crime rate and long life expectancy of its residents.

The top 20 most secure large metropolitan areas in the U.S. among 114 studied were: Madison; Des Moines, Iowa; Syracuse, N.Y.; Austin, Texas; Portland, Maine; Rochester, N.Y.; Honolulu; El Paso, Texas; Bethesda, Md.; Seattle; Pittsburgh; Minneapolis-St. Paul;  Nassau-Suffolk Counties, N.Y.; McAllen, Texas; Bridgeport, Conn.; Raleigh, N.C.; Albany, N.Y.; Wichita, Kan.; Buffalo, N.Y.; and New Haven, Conn.

As Madison as it gets: Get Cap Times' highlights sent daily to your inbox

The most secure mid-size (150,000-500,000 residents) metropolitan area was Olympia, Wash. and the most secure small-size (less than 150,000 residents) metro area was Lewiston, Idaho.