Any mayor will tell you that running a modern US city isn't an easy task. Even wealthy enclaves in the middle of a gentrification boom sometimes have trouble providing basic services (have you ridden the New York City subway lately?). While dysfunction abounds in municipalities across the US, researchers at WalletHub recently challenged themselves to come up with a formula for evaluating the best and worst-run cities in the country.

After deciding that cities should be judged by the quality and efficacy of services delivered to taxpayers, WalletHub put together a "Quality of Services" score made up of 35 metrics grouped into six categories. They then compared that with the city's per-capita budget.

The results may surprise some readers. The largest US city in the top ten was Oklahoma City, which ranked as the 10th-best run city in the US. Instead, the top of the list was mostly dominated by smaller cities like Nampa, Idaho and Provo, Utah.

Top 10 Best-Run Cities in the US:

Nampa, Idaho

Provo, Utah

Boise, Idaho

Lexington-Fayette, Kentucky

Missoula, Montana

Sioux Falls, South Dakota

Durham, North Carolina

Lewiston, Maine

Nashua, New Hampshire

Oklahoma City, Oklahoma

The respective ranks of each of the 150 largest US cities can be found below:

WalletHub also broke down its ranking by different metrics like lowest debt and highest high-school graduation rate: