Napoleon's French army briefly occupied Egypt from 1798 to 1801, after which an Albanian officer in the Ottoman army named Muhammad Ali Pasha made Cairo the capital of an independent empire that lasted from 1805 to 1882. The city then came under British control until Egypt was granted its independence in 1922.