It was probably William the Conqueror who gave the city and its castle to Bishop Odo of Bayeux, the king's half brother. On William's death in September 1087 his territories were divided between his two sons. Robert, the elder, inherited the title of Duke of Normandy and William Rufus became King of England. A significant number of Norman barons objected to dividing Normandy and England, and Bishop Odo supported Robert's claim to the English throne. Several others, including the earls of Northumberland and Shrewsbury and the Bishop of Coutances came out in support of Robert. Odo prepared Rochester Castle for war and it became one of the headquarters of the rebellion. Its position in Kent made it a suitable base for raids on London and its garrison could harry William's forces in the county. William set off from London and marched towards Rochester to deal with the threat. Before he arrived, news reached the king that Odo had gone to Pevensey Castle, which was under the control of Robert, Count of Mortain. William turned away from Rochester and seized Pevensey. The captured Odo was forced to swear to hand over Rochester to William's men. The king despatched a force with Odo in tow to demand Rochester's surrender. Instead of yielding, the garrison sallied and captured the entire party. In response William laid siege to the city and castle. Contemporary chronicler Orderic Vitalis recorded that the siege began in May 1088. Two siege-castles were built to cut off the city's supply lines and to protect the besiegers from sorties. Conditions within the city were dire: disease was rampant, exacerbated by the heat and flies. The garrison ultimately capitulated and terms were agreed. Odo, Eustace, Count of Boulogne, and Robert de Belleme, son of the Earl of Shrewsbury, were allowed to march away with their weapons and horses but their estates in England were confiscated. This marked the end of the castle's role in the rebellion, and the fortification was probably abandoned shortly afterwards. The siege-castles were abandoned after the conclusion of the siege and have since vanished.After the abandonment of Rochester's first castle it was replaced by another on the current site, in the south-west corner of the town walls. Founded between 1087 and 1089, some parts of the castle survive although it has been much altered by use and reuse in subsequent centuries. William the Conqueror had granted Lanfranc, Archbishop of Canterbury, the manor of Haddenham in Buckinghamshire – which as of the Domesday Survey had an annual income of £40 – for the duration of his life. In turn, the archbishop had granted the manor to Rochester's monks, so on the Conqueror's death Lanfranc and Gundulf, who was appointed Bishop of Rochester in 1077, had to appeal for reconfirmation of the original grant from the new king. William Rufus demanded £100 in exchange for confirmation of the grant. The two bishops felt such a sum was beyond their means and sought a compromise. Instead it was agreed that Gundulf would build a new stone castle at Rochester. Initially the two bishops were concerned that the cost would exceed the king's original request and that they would be responsible for the castle's upkeep. However Henry, Earl of Warwick, convinced them that a castle suitable for the king could be constructed for £40 and that following its completion the castle would be handed over to someone else. The actual cost to Gundulf was £60. The bishop was a skilled architect and supervised the construction of the Tower of London's eponymous White Tower on behalf of William the Conqueror. Gundulf's castle was adjacent to Rochester Cathedral. According to archaeologist Oliver Creighton, when castles were positioned close to churches or cathedrals it suggested a link between the two, and in this case both were owned by the Bishop of Rochester. Often the same craftsmen and architects would work on these closely related buildings, leading to similarities in some of their features. Along with Durham and Old Sarum, Rochester is one of the best examples of a closely linked castle and religious building.

Question: Where was the castle William laid siege to?
Answer: Rochester