Walls could be undermined by a sap. A mine leading to the wall would be dug and once the target had been reached, the wooden supports preventing the tunnel from collapsing would be burned. It would cave in and bring down the structure above. Building a castle on a rock outcrop or surrounding it with a wide, deep moat helped prevent this. A counter-mine could be dug towards the besiegers' tunnel; assuming the two converged, this would result in underground hand-to-hand combat. Mining was so effective that during the siege of Margat in 1285 when the garrison were informed a sap was being dug they surrendered. Battering rams were also used, usually in the form of a tree trunk given an iron cap. They were used to force open the castle gates, although they were sometimes used against walls with less effect.