Austrian Emperor Francis Joseph agreed in 1867 to allow Hungary to become a separate state. Hungary was given its own constitution and nearly independent status. The empire was known as Austria-Hungary and popularly referred to as the dual monarchy. It lasted until the end of World War I in 1918, when Hungary declared itself an independent republic.