When you retire from the military, you regain the long lost freedom to choose where you live.

Analysts at the research firm WalletHub did a study to find the best states for military retirees based on quality of life, economic environment, and health care. And considering the average age of a new military retiree is between 43 and 47, there are a number of factors that should play into your post-service residency decision.

Based on the study performed by WalletHub, here are five of the best states for veteran retirees.

Alaska

Alaska was ranked number one. According to WalletHub, the state is one of the best economic environments for military retirees. Across Alaska, there are 21 job centers that prioritize veterans for employment openings. It also has a veterans land discount program allows certain veterans a 25% discount on the purchase price of state residential/recreational land.

South Dakota

Coming in at number two, South Dakota boasts a number of attractions for military retirees. First off, there is no property tax for veterans or widows and widowers of veterans. Free tuition is available at South Dakota state schools for veterans outside of the GI Bill. And although this only applies to former residents, the state also offers an annual bonus of $500 for active-duty service members or veterans who were legal residents of the state for six months immediately preceding their period of active duty.

Related: 3 Ways To Be Financially Prepared When You Retire »

Montana

Montana comes in at number one for quality of life and health care, according to WalletHub. Number three in the nation, it offers the Honorably Discharged State Veteran Tuition Waiver, which eliminates the cost of tuition for eligible veterans. And as far as jobs go, public employers use a point preference system, meaning veterans add five to 10 qualifying points onto any job application that uses a scoring system.

Wyoming

Bear River, Wyoming

Coming  in at number four, Wyoming offers veteran residents a number of perks. Veterans who have been residents for three or more years and have a DD-214 or equivalent, you are eligible for tax exemption. The state also offers free tuition and fees for education for veterans and children survivors.

Florida

PALM_BEACH_FLORIDA_AERIAL_2011

Florida is sort of the unofficial retirement capital of the country, but it’s also particularly attractive to military retirees. Veteran residents with service-connected disability greater than 10% are eligible for a $5,000 property tax exemption. Florida also waives undergraduate tuition at state universities and community colleges for Purple Heart recipients or other similar combat decorations. Under Title 38, the state also allows veteran residents the ability to defer education payments for a year if need be.

See a map of all 50 states ranked here.

Source: WalletHub