Bannack was the first territorial capital Montana, however, the territorial legislature moved the capital to Virginia City in 1865. It remained the capital until 1875 when it moved to Helena.