President Barack Obama blasted the 2016 Republican presidential candidates for using "anti-immigrant sentiment" in their campaigns in effort to gain attention and votes.

While speaking at the Congressional Hispanic Caucus Awards Gala Thursday night, President Obama called for an overhaul of the immigration system while denouncing some of the GOP contenders without using any of their names, reports CNN.

"The anti-immigrant sentiment that has infected our politics is not new, but it is wrong," said Obama in front of a crowd of 2,000 people.

Obama pointed out that throughout history, Irish and Italians immigrants have also been subjected to "some of the same stereotypes," adding, "Unless you were one of the first Americans -- unless you're Navajo or Cherokee -- somebody somewhere came from someplace else," according to USA Today.

Obama also made a reference to GOP presidential frontrunner Donald Trump, who campaigns for building an expensive wall along the entire U.S.-Mexican border. He has also received backlash for calling Mexican immigrants drug traffickers and rapists during his presidential election announcement speech in June.

"You've got to recognize that America's greatness does not come from building walls," Obama said. "Our greatness comes from building opportunity."

The president also took a jab at Florida Sen. Marco Rubio, who helped draft a bipartisan immigration reform bill back in 2013.

"Some of the very same Republican politicians who championed reform, some of whom sponsored these efforts, suddenly they want nothing to do with it," Obama said.

"Now some of the very same Republican politicians who championed reform in the past -- some of whom sponsored these efforts -- suddenly they want nothing to do with it," Obama added.

Obama went on to call for a new immigration system that would provide the 11 million undocumented immigrants currently living in the U.S. illegally with a pathway to citizenship.