The dense cloud of pollution choking cities around the world may be impacting the mood as well as the health of urban populations.

A new study conducted in China found a clear association between low levels of happiness among city dwellers and levels of toxic air pollution.

Scientists used real-time data on people’s moods obtained from social media and compared it against levels of airborne particulate matter that has been linked to lung disease.

With air pollution already responsible for 1.1 million premature deaths in China and costing the nation’s economy $38bn (£29.5bn) every year, the research suggests it is also having a pervasive effect on mental health.

China has seen rapid economic growth in recent years, a trend that would normally result in a marked increase in the happiness of a population.

However, one side effect of this growth has been the tiny particles, which have enveloped cities like Beijing and Shanghai, spewed out by coal burning plants and traffic.

The researchers behind the new study suggest this air pollution may explain the modest improvements in happiness scores seen in the Chinese population compared to their relative prosperity.

People told to stay indoors as air pollution in Beijing reaches hazardous levels Show all 5 1 /5 People told to stay indoors as air pollution in Beijing reaches hazardous levels People told to stay indoors as air pollution in Beijing reaches hazardous levels beijing-1.jpg A woman wearing a mask crosses a road during severe pollution in Beijing GETTY People told to stay indoors as air pollution in Beijing reaches hazardous levels beijing-2.jpg A woman wearing a mask walks on a street during severe pollution in Beijing GETTY People told to stay indoors as air pollution in Beijing reaches hazardous levels beijing-3.jpg Parking attendants stand on a roadside during severe pollution in Beijing GETTY People told to stay indoors as air pollution in Beijing reaches hazardous levels beijing-4.jpg Traffic makes its way through Beijing GETTY People told to stay indoors as air pollution in Beijing reaches hazardous levels beijing-5.jpg Severe pollution clouds the Beijing skyline GETTY

To measure happiness in 144 Chinese cities, they used an algorithm to analyse the mood of 210 million tweets from the popular microblogging site Sina Weibo.

“Social media gives a real-time measure of people’s happiness levels and also provides a huge amount of data, across a lot of different cities,” said Professor Siqi Zheng, a Massachusetts Institute of Technology scientist who led the research.

The team then merged this data with information about particulate levels and weather patterns.

They found surges in pollution correlated with dips in happiness, and this was particularly true for women and people with higher incomes.

These results were published in the journal Nature Human Behaviour.

Professor Andrea Mechelli, who leads the Urban Mind project at King’s College London and was not involved in the new study, told The Independent it was a valuable addition to a growing body of evidence about air pollution and mental health.

Theresa May responds to high court ruling that air pollution plan is 'unlawful'

“We don’t yet fully understand what the underlying mechanism is – what is mediating the association between pollution and poor mental health,” he said, noting there are likely multiple factors.

These factors could include direct effects by which pollution hampers people’s ability to think or stress levels, as well as indirect effects such as polluted air making it harder to socialise outside.