President Donald Trump said late Wednesday that his administration would issue a notice of environmental violation against the city of San Francisco because of what he described as its homelessness problem.

Traveling aboard Air Force One as he returned to Washington from a three-day trip to California and New Mexico, Trump told reporters that San Francisco was in "total violation" of environmental rules because of used needles that were ending up in the ocean.

"They're in total violation — we're going to be giving them a notice very soon," the president said, indicating that the city could be put on notice by the Environmental Protection Agency within a week that its homelessness problem was causing environmental damage.

He said tremendous pollution was flowing into the ocean because of waste in storm sewers, and he specifically cited used needles. "They have to clean it up," Trump said, adding, "We can't have our cities going to hell."

San Francisco's mayor, London Breed, called Trump's comments "ridiculous."

"To be clear, San Francisco has a combined sewer system, one of the best and most effective in the country, that ensures that all debris that flow into storm drains are filtered out at the city's wastewater treatment plants," Breed said in a statement Wednesday night. "No debris flow out into the bay or the ocean."

She also said that the city would be adding 1,000 shelter beds by next year and is seeking to pass a $600 million bond to build additional affordable housing and increase services for people with mental illnesses and drug addictions.

The president's threat marked the second time in two days that Trump had clashed with California politicians. On Tuesday, the administration said it would revoke the state's ability to set tougher auto emissions standards, drawing a fierce rebuke from Gavin Newsom, the state's Democratic governor.

Trump has indicated for weeks that he is angry and frustrated by what he sees as an out-of-control homelessness problem in San Francisco and Los Angeles — two heavily Democratic cities run by politicians who have been regularly critical of Trump.

On Twitter in July, the president lashed out at Speaker Nancy Pelosi, whose district includes San Francisco, saying that the city was "not even recognizeable lately."

"Something must be done before it is too late," he added. "The Dems should stop wasting time on the Witch Hunt Hoax and start focusing on our Country!"

During an interview in July with Tucker Carlson of Fox News, Trump lamented the state of American cities like San Francisco, Los Angeles and New York, suggesting that homelessness and drug use was so bad that it was a public health hazard.

"You can't have what's happening — where police officers are getting sick just by walking the beat," Trump told Carlson. "I mean, they're getting actually very sick, where people are getting sick, where the people living there living in hell, too."

He added that when world leaders come to an American city, they should not see homeless people. "They're riding down a highway, they can't be looking at that," he said. "I really believe that it hurts our country."