City gates were traditionally built to provide a point of controlled access to and departure from a walled city for people, vehicles, goods and animals. Depending on their historical context they filled functions relating to defense, security, health, trade, taxation, and representation, and were correspondingly staffed by military or municipal authorities. The city gate was also commonly used to display diverse kinds of public information such as announcements, tax and toll schedules, standards of local measures, and legal texts. It could be heavily fortified, ornamented with heraldic shields, sculpture or inscriptions, or used as a location for warning or intimidation, for example by displaying the heads of beheaded criminals or public enemies.
City gates, in one form or another, can be found across the world in cities dating back to ancient times to around the 19th century. Many cities would close their gates after a certain curfew each night, for example Prague.
With increased stability and freedom, many walled cities removed such fortifications as city gates, although many still survive; albeit for historic interest rather than security. Many surviving gates have been heavily restored, rebuilt or new ones created to add to the appearance of a city, such as Bab Bou Jalous in Fes. With increased levels of traffic, city gates have come under threat in the past for impeding the flow of traffic, such as Temple Bar in London which was demolished in the 18th century.