OTTUMWA, Iowa -- Mitt Romney said Saturday that he would veto the Dream Act, a bill that would provide legal status to some undocumented immigrants who entered the United States as children.

"The question is, if I were elected and Congress were to pass the Dream Act, would I veto it? And the answer is yes," said the candidate, speaking in Le Mars, Iowa.

But he added that he could support a system that offered legal status to people who served in the U.S. military. One provision of the Dream Act, which failed in the Senate when it last came up for a vote in December 2010, would allow some undocumented immigrants to work toward citizenship by joining the armed services for at least two years.

Undocumented immigrants are currently barred from serving in the military, although some do anyway. Only undocumented immigrants who entered the country under the age of 16, had clean criminal records and either attended college for at least two years or joined the military would be eligible for legal status under the bill.

Although the Dream Act once enjoyed considerable bipartisan support -- it was first introduced by Republican Sen. Orrin Hatch of Utah and Democratic Sen. Dick Durbin of Illinois -- it has since been coined "amnesty," something of a death knell for immigration reform measures among Republicans.

Romney said he wants to take more steps to end unauthorized immigration into the country. He also took a dig at fellow candidate and Texas Gov. Rick Perry, though not by name, for a law Perry signed that allows some undocumented immigrants in Texas to receive in-state college tuition.

"For those who come here illegally, the idea of giving them in-state tuition credits or other special benefits I find to be contrary to the idea of a nation of law," Romney said. "If I'm the president of the United States, I want to end illegal immigration so that we can protect legal immigration."

Jon Ward contributed to this report.