In the course of the German mediatization in 1803, the prince-bishoprics of Trent and Brixen were secularized and merged into the County of Tyrol (which in the next year became a constituent land of the Austrian Empire), but Tyrol was ceded to the Kingdom of Bavaria in 1805. Andreas Hofer led the Tyrolean Rebellion against the French and Bavarian occupiers. Later, South Tyrol was ceded to the Kingdom of Italy, a client state of the First French Empire, by Bavaria in 1810. After Napoleon's defeat, the whole of Tyrol was returned to Austria in 1814.