San Diego is the sixth-best city in the country for veterans, financial literacy website WalletHub said Monday.

The website ranked the 100 largest cities in the U.S. based on factors including overall economic strength, education quality and a series of veteran-specific criteria, such as the percentage of veterans living below the poverty line.

San Diego received an average score on economic factors, such as housing affordability, military skill-related jobs in the areas and job growth. But it ranked the best in the nation in the environment, education and health category, which accounted for veteran population size, educational opportunities and the quality of Veteran Affairs’ hospitals.

Irvine, Scottsdale, Ariz., and Raleigh, N.C. were the three best cities for veterans, largely based on high economic scores. Detroit, Newark and Hialeah, Fla. were the bottom three cities, though Hialeah had the second-lowest veteran unemployment rate in the country.