The Ainsty or the Ainsty of York was a historic district of Yorkshire, England adjacent to the City of York. Originally a wapentake or subdivision of the West Riding of Yorkshire it later had a unique status as a rural area controlled by the corporation of the city.
The Ainsty covered a few square miles situated to the west of York. It was bounded by three rivers: the Nidd to the north; the Ouse to the east and the Wharfe to the south. The Ainsty was unique among the wapentakes of Yorkshire in that it was not formally included in any Ridings from 1449 until 1836.
The Ainsty originally formed part of the West Riding of Yorkshire, although the City of York claimed jurisdiction over the area under a royal charter of King John granted in the early 13th century. The validity of this charter was a matter of dispute between the city and the Crown, eventually leading to the imprisonment of the mayor in 1280 when it was proved that a clause in the document had been altered. The bailiffs of the city were subsequently able to resume jurisdiction of the wapentake, although it was not formally included in the city when it was created a county of itself in 1396.
In 1449 the Ainsty was annexed to York, with the sheriffs of the city assuming authority. The city, which was said to be "in decay" was granted the "privileges and franchises" of the Ainsty to improve its financial position. In 1463 the mayor and aldermen were made justices of the peace with the commission of oyer and terminer.
The Municipal Corporations Act 1835 reformed the City of York as a municipal borough with effect from 1 January 1836. It was unclear if the reformed corporation still had jurisdiction in the Ainsty. The matter was finally settled by the Municipal Corporations (Boundaries) Act 1836 which came into force in August. Under the legislation the Ainsty was declared to be part of the West Riding for all purposes. When elected county councils were created by the Local Government Act 1888, the Ainsty's inclusion in the West Riding was confirmed.