Martin O'Malley speaks during an event to announce his candidacy for a presidential campaign May 30, 2015 at Federal Hill Park in Baltimore, Maryland.Alex Wong AFP/Getty

With Donald Trump still leading the Republican race, Martin O'Malley followed the lead of many Republican candidates and criticized the business magnate with hopes of gaining more attention for his own campaign.

The former Maryland governor spoke in front of the Trump International Hotel in Las Vegas Wednesday with hotel workers who are trying to unionize, and he lambasted the Republican front-runner on labor and his comments on immigration, saying they were two things Trump didn't understand.

"If we want our economy to grow, we need to treat our workers with dignity and respect, pay them better, and respect their right to organize," O'Malley said. "In every generation, new American immigrants have made our economy stronger and made our economy better."

O'Malley also used the opportunity to praise the workers trying to organize.

"Donald Trump as a presidential candidate—I want to say that all of these workers here have a lot more guts than the candidates running for president of the Republican nomination," he said. "Because they have the courage to stand up to the hate, to the division, to the sort of rhetoric that actually makes it harder for us to make our economy grow and work well for all Americans."

O'Malley's swipes at Trump come as he continues to lag in the polls behind Democratic front-runner Hillary Clinton and Sen. Bernie Sanders, who is starting to chip away at Clinton's lead.

In turn, O'Malley is following the trend of many Republicans who are trailing Trump in their primary race—Sen. Lindsey Graham calling Trump "a jackass," Sen. Rand Paul releasing an ad showing Trump praising Democrats, and former Texas Gov. Rick Perry calling Trump "a cancer" on conservatism.

Meanwhile, Louisiana Gov. Bobby Jindal has said he's going to drop Trump's name randomly in speeches to get media attention, and Wisconsin Gov. Scott Walker, Sen. Ted Cruz, and others have tried to take on pieces of Trump's persona and platform for their own campaigns. The only difference for O'Malley is he is trying to use his criticisms of Trump to prove to Democratic voters that he is committed to workers' rights and immigration reform in a way that would engender their support.

But none of those attempts have gained much traction for the contenders on the Republican side, and most Democrats agree that comprehensive immigration reform should be passed and workers should be allowed to collectively bargain, so it's not as if O'Malley is making a bold stance.

Nevertheless, O'Malley is trying to hitch his wagon to Trump. And this article's existence alone shows you can get yourself some attention by doing so. At least for a little while.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.