Construction of the town fortification was the biggest construction project in Hungary at that time. Nowadays, the fortification belongs to the most significant sights in Slovakia and Europe not just because of their several long parts preserved.
The construction of the fortification launched in the first half of the 13th century. It was much easier to use bricks, because the nearest stone mine was located in mountains Malé Karpaty. About 4,3 million bricks were used during the construction, which meant that it was the most important construction project in Hungary. There aren't many fortifications in Slovakia that are as preserved as town walls of Trnava.
The square defensive towers were built at first. Later a moat was dug and the soil was used to build a temporary wall between towers until proper wall was finished. People could enter the town through four gates. The walls were guarded by hired guardians led by a captain. The town fortification served its purpose until the 18th century.
Despite its powerful fortification, Trnava was conquered for several times. Ottokar II. of Bohemia, managed to conquer the town in 1271 and 1273. Later, Czech Hussits occupied Trnava. In 1506, the walls had to resist the attacks of Maximilian von Habsburg that occupied them with his army. The walls resisted the vicious attack, but were severely damaged.