The first motte and bailey castle on the site was built in 1068 following the Norman conquest of York. After the destruction of the castle by rebels and a Viking army in 1069, York Castle was rebuilt and reinforced with extensive water defences, including a moat and an artificial lake. York Castle formed an important royal fortification in the north of England.
In 1190, 150 local Jews were killed in a pogrom in the castle keep; most of them committed suicide in order not to fall into the hands of the mob. Henry III rebuilt the castle in stone in the middle of the 13th century, creating a keep with a unique quatrefoil design, supported by an outer bailey wall and a substantial gatehouse. During the Scottish wars between 1298 and 1338, York Castle was frequently used as the centre of royal administration across England, as well as an important military base of operations.
York Castle fell into disrepair by the 15th and 16th centuries, becoming used increasingly as a jail for both local felons and political prisoners. By the time of Elizabeth I the castle was estimated to have lost all of its military value but was maintained as a centre of royal authority in York. The outbreak of the English Civil War in 1642 saw York Castle being repaired and refortified, playing a part in the Royalist defence of York in 1644 against Parliamentary forces. York Castle continued to be garrisoned until 1684, when an explosion destroyed the interior of Clifford's Tower. The castle bailey was redeveloped in a neoclassical style in the 18th century as a centre for county administration in Yorkshire, and was used as a jail and debtors' prison. Prison reform in the 19th century led to the creation of a new prison built in a Tudor Gothic style on the castle site in 1825; used first as a county and then as a military prison, this facility was demolished in 1935. By the 20th century the ruin of Clifford's Tower had become a well-known tourist destination and national monument; today the site is owned by English Heritage and open to the public. The other remaining buildings serve as the York Castle Museum and the Crown Court.
York was a Viking capital in the 10th century, and continued as an important northern city in the 11th century. In 1068, on William the Conqueror's first northern expedition after the Norman Conquest, he built a number of castles across the north-east of England, including one at York. This first castle at York was a basic wooden motte and bailey castle built between the rivers Ouse and Foss on the site of the present-day York Castle. It was built in haste; contemporary accounts imply it was constructed in only eight days, although this assertion has been challenged. The motte was originally around 200 feet (61 metres) wide at the base. As it was built in an urban environment, hundreds of houses had to be destroyed to make way for the development. William Malet, the sheriff of Yorkshire, was placed in charge of the castle and successfully defended it against an immediate uprising by the local population.
In response to the worsening security situation, William conducted his second northern campaign in 1069. He built another castle in York, on what is now Baile Hill on the west bank of the Ouse opposite the first castle, in an effort to improve his control over the city. This second castle was also a motte and bailey design, with the Baile Hill motte probably reached by a horizontal bridge and steps cut up the side of the motte. Later that year, a Danish Viking fleet sailed up to York along the Humber and the Ouse, and attacked both castles with the assistance of Cospatrick of Northumbria and a number of local rebels. The Normans, attempting to drive the rebels back, set fire to some of the city's houses. The fire grew out of control and also set fire to York Minster and, some argue, the castles as well. The castles were captured and partially dismantled, and Malet was taken hostage by the Danes.