Miles City is a city in and the county seat of Custer County, Montana, United States. The population was 8,354 at the 2020 census. After the Battle of the Little Bighorn in 1876, the U.S. Army created forts in eastern Montana, including one where the north-flowing Tongue River flowed into the east-flowing Yellowstone River. The first fort was known as the Tongue River Cantonment or the Tongue River Barracks and was founded on August 27, 1876. A second, permanent fort was constructed on higher ground two miles to the west of the mouth of the Tongue and this became Fort Keogh.