Mr Ban made his remarks in an address at the UN Habitat III conference that is only held once every 20 years.
Many urban areas, which are home to more than half of the world population, continue to grow unplanned and unregulated, experts warn.
An estimated 35,000 people attended the three-day gathering in Quito, Ecuador.
‘Mayors are at the forefront of the battle for sustainability,’ Mr Ban told an audience at the world assembly of mayors, which was being held at the Habitat III conference.
‘You are faced with the immediate daily demands of your people; for housing, transport, infrastructure and sustainable urban development.’
But, he added, they also had to ‘make the tough decisions on what issues to prioritise’ because they had to operate within tight budgets.
Mr Ban told the city leaders and politicians that they were at the heart of delivering global agreements, such as the UN Sustainable Development Goals and the Paris Climate Agreement.
‘Take strong ownership of this vital agenda – stand up for the people you represent,’ he urged them.
The conference, which the UN described as one of the largest in the organisation’s history, was focused on adopting a blueprint that would help shape and deliver urban development over the next 20 years.
The New Urban Agenda recognised that urbanisation had to be seen as a tool for development in the 21st Century, explained Joan Clos, UN Habitat’s executive director and the conference’s secretary general.
He said that recent events, such as the global financial crisis and the urban revolts during the Arab Spring, had highlighted the importance of sustainable urban development.
‘It’s a proposal to revisit urbanisation,’ Dr Clos observed, ‘and avoid the mistakes that have been developing in the past 20 years.
‘When we look at the statistics, (where) the level of planned organisation has decreased, the quality of the planning has also decreased.
‘That has created a very deadly situation where a lot of people are suffering in many cities for a lack of urban design, a lack of adequate management and a lack of urban finances. We need to recover that,’ he said.
He said there was a need to go ‘back to basics’ and called on delegates not to see the document as a new agenda but to see it as a blueprint for the ‘forgotten agenda’.
Habitat III is formally known as the United Nations Conference on Housing and Sustainable Urban Development.
It is the third in a series of global gatherings that are held once every 20 years. The first was staged in Vancouver, Canada in 1976, and the second was hosted by Istanbul, Turkey, in 1996.
During that time, the world’s human population has shifted from being a rural population to being an urban one, with an estimated 54% of people now living in urban areas. Projections forecast that percentage is set to reach 66% by the middle of this century.
In 1950, less than one-in-three people lived in urban areas. The world had just two so-called ‘megacities’ with populations in excess of 10 million: New York and Tokyo. Today, there are more than 20.
Greater Tokyo, the world’s biggest urban area, has expanded from 13 million residents in 1950, to today’s figure of 38 million.
It is estimated that almost 200,000 people each day are moving to urban areas. Developing nations are shouldering the vast majority of this burden, leaving them struggling to cope with the huge influx of people. Some cities’ populations are 40 times larger than what they were in 1950.
This has resulted in the rapid expansion of unplanned and unregulated ‘slums’ on the edge of cities.
Organisers of the Habitat III conference observed: ‘It is now well understood that slums and the related informal settlements are a spontaneous form of urbanisation, consisting of a series of survival strategies by the urban poor, most borne out of poverty and exclusion.’
The adoption of the New Urban Agenda by delegates from 167 nations is an attempt to reverse the ‘legacy of the 20th Century’: uncontrolled urbanisation and urban poverty.