Middlesex (ˈmɪdəlsɛks; abbreviation: Middx) is a historic county in southeast England. Its area is almost entirely within the wider urbanised area of London and mostly within the ceremonial county of Greater London, with small sections in neighbouring ceremonial counties. Three rivers provide most of the county's boundaries; the Thames in the south, the Lea to the east and the Colne to the west. A line of hills forms the northern boundary with Hertfordshire.
Middlesex county's name derives from its origin as the Middle Saxon Province of the Anglo-Saxon Kingdom of Essex, with the county of Middlesex subsequently formed from part of that territory in either the ninth or tenth century, and remaining an administrative unit until 1965. The county is the second smallest, after Rutland, of the historic counties of England.
The City of London became a county corporate in the 12th century; this gave it self-governance, and it was also able to exert political control over the rest of Middlesex as the Sheriff of London was given jurisdiction in Middlesex, though the county otherwise remained separate. To the east of the City, the Tower Division (or Tower Hamlets) had considerable autonomy under its own Lord Lieutenant.
As London expanded into rural Middlesex, even given the London Sheriffs' jurisdiction, the Corporation of London resisted attempts to expand the City of London boundaries into the county, posing problems for the administration of local government and justice. In the 18th and 19th centuries, the population density was especially high in the southeast of the county, including the East and West Ends of London. In 1855, in response to these challenges the densely populated southeast, together with sections of Kent and Surrey, came under the Metropolitan Board of Works for certain infrastructure purposes, while remaining a part of Middlesex.