The history of Berlin starts with its foundation in the 13th century. It became the capital of the Margraviate of Brandenburg in 1417, and later of Brandenburg-Prussia, and the Kingdom of Prussia. Prussia grew rapidly in the 18th and 19th century, and formed the basis of the German Empire in 1871.