The New York City mayor cultivated a close relationship with President Trump, who said they had both been persecuted.