The Trump campaign released the ad, titled "Complicit," on the anniversary of the Republican president's inauguration.
It focuses on an undocumented immigrant, Luis Bracamontes, charged in the 2014 killings of two police officers in Sacramento, California. The man's lawyers had questioned his sanity but a judge found him mentally competent to stand trial, according to a report last week in the Sacramento Bee.
"Democrats who stand in our way will be complicit in every murder committed by illegal immigrants," the ad says.
The new ad is likely to anger Democrats and immigration advocates and could inflame tensions over the issue on Capitol Hill, where Democrats and Republicans were working through the weekend to reach an agreement that would reopen the government.
A news release announcing the ad blamed Senate Democratic Leader Chuck Schumer for the shutdown, accusing him and Democrats of "holding lawful citizens hostage over their demands for amnesty for illegal immigrants."
Schumer's spokesman said in an email, "This is a shameless attempt by the president to distract from the Trump shutdown. Rather than campaigning, he should do his job and negotiate a deal to open the government address the needs of the American people."
"It's a campaign ad, which tend to be extreme, but this is completely divorced from reality and full of fear and hate," said Melanie Nezer, vice president of the refugee agency HIAS.
Trump filed for re-election the day he took office, an unusual move that has allowed him to begin campaigning long before the November 2020 election. Historically, incumbent presidents have waited two years, until after the midterm elections, to file formally.
On Friday, most Senate Democrats opposed a bill that would have avoided the shutdown, because their efforts to include protections for hundreds of thousands of mostly young immigrants, known as Dreamers, were rejected by Trump and Republican leaders.
The Dreamers were brought illegally into the United States as children, and given temporary legal status under a program started by former President Barack Obama.
(Reporting by Ginger Gibson and Doina Chiacu; Editing by Alistair Bell)