The California cities of San Bernardino, Oakland and Los Angeles have been ranked among the state’s most dangerous cities, according to a new study from WalletHub.

"Threats to safety in the U.S. come in many forms, from the continued presence of the COVID-19 pandemic and natural disasters to mass shootings and traffic accidents," WalletHub’s financial writer Adam McCann said, describing the intent of the study.

"No one can avoid all danger, however, and we take on a certain level of risk based on where we choose to live. Some cities are simply better at protecting their residents from harm," he added.

A photo of a crime scene in San Bernardino

A large police presence outside North Park Elementary School in San Bernardino, California, on April 17, 2017. (Beatriz Valenzueal/San Bernardino Sun)

The study included the 182 biggest U.S. cities and assessed how each protects its residents against crime and traffic accidents. The national rankings also considered natural disaster risk, financial safety and COVID-19 protections.

CALIFORNIA WOMAN MISSING FOR TWO MONTHS FOUND DEAD AT CAR CRASH SITE

San Bernardino was ranked particularly dangerous — 180th on the list — ahead only of Fort Lauderdale, Florida (181), and St. Louis, Missouri (182).

A sheriff at a press conference

Sheriff Alex Villanueva addresses a news conference to discuss the sheriff's department budget at Hall of Justice in in Los Angeles on Oct. 5, 2022. (Irfan Khan / Los Angeles Times via Getty Images)

Following San Bernardino, California’s top 10 most dangerous cities included Oakland (175), Los Angeles (172), Stockton (149), Bakersfield (144), Long Beach (139), San Francisco (136), Riverside (126), Modesto (118) and Fresno (113).

California also had several cities ranked among the safest in the country, including six in the top 50. Those cities included Fremont (17), Irvine (26), Chula Vista (38), Santa Rosa (39), Glendale (40) and San Diego (48).

CALIFORNIA MAN KIDNAPPED IN BROAD DAYLIGHT, REMAINS MISSING

California had 29 cities make the national rankings.

A crime scene in Oakland

Oakland police investigate a mass shooting at the King Estates Complex school campus in East Oakland, Calif., on Sept. 28, 2022. (Jane Tyska/Digital First Media/East Bay Times via Getty Images)

CLICK HERE TO GET THE FOX NEWS APP

Other notable cities ranked lowly on the list as the most dangerous included Detroit (179); Philadelphia (170); Washington, D.C. (168); Dallas (166); Baltimore (161); Atlanta (134); and Chicago (133).

According to WalletHub, the top five safest cities in the U.S. were Columbia, Maryland; Nashua, New Hampshire; Laredo, Texas; Portland, Maine; and Warwick, Rhode Island.