In the early 18th century, Karim Khan of the Zand dynasty ordered a palace and a government office to be built in Tehran, possibly to declare the city his capital; but he later moved his government to Shiraz. Eventually, Qajar king Agha Mohammad Khan chose Tehran as the capital of Iran in 1776.