Republican presidential nominee Donald Trump said he is open to granting legal status to undocumented immigrants living in the United States who join the military.

"I think that when you serve in the armed forces, that's a very special situation, and I could see myself working that out. Absolutely," Trump said during a televised national forum on Wednesday evening, answering a question of an audience member.

“I think the military is a very special thing,” the billionaire businessman added. “If they plan on serving, if they get in, I would absolutely, for all of those people. Now, we have to be very careful, we have to vet very carefully, everybody would agree with that, but the answer is it would be a very special circumstance, yes.”

Trump’s comments were made during the forum in which he and Democratic rival Hillary Clinton each fielded 30 minutes of questions about their experience and judgement to be commander in chief.

While the candidates never appeared on stage together, their back-to-back sessions served as a preview of sorts for their upcoming debates.

In addition to his comments regarding undocumented immigrants serving in the military, Trump leveled unusually harsh criticism against the military and said that America’s generals have been “reduced to rubble” under President Barack Obama. He also suggested he would fire some of them if he wins the presidency.

By virtue of a coin flip, Clinton took the stage first and quickly found herself responding at length to questions about her years in government. She reiterated that she had made mistakes in relying on a personal email account and private server as secretary of state and in voting for the 2003 invasion of Iraq as a senator. But she defended her support for U.S. military intervention to help oust a dictator in Libya, despite the chaotic aftermath.

"I'm asking to be judged on the totality of my record," said Clinton, who grew visibly irritated at times with the repeated focus on her past actions.

Clinton, who has cast Trump as dangerously ill-prepared to be commander in chief, tried to center the discussion on her foreign policy proposals should she win in November. She vowed to not send American ground troops into Iraq or Syria to fight the Islamic State group. And she pledged to hold weekly Oval Office meetings with representatives from the Pentagon and Department of Veterans Affairs to stay abreast of health care for veterans.

Trump did little to counter the criticism that he lacks detailed policy proposals, particularly regarding the Islamic State. He both insisted he has a private blueprint for defeating the extremist group and that he would demand a plan from military leaders within 30 days of taking office.

Asked to square his request for military options with his harsh criticism of the current crop of generals, Trump said simply: "They'll probably be different generals."

Trump renewed his praise of Russian President Vladimir Putin for having "great control over his country." He stood by a previous comment that appeared to blame military sexual assaults on men and women serving together, but added he would not seek to remove women from the military.

As a businessman with no substantial national security experience, Trump was vague about how he is preparing for the enormous array of complex issues that would land on his desk as commander in chief. He cited his team of military advisers, but also said he has "a common sense" that will help him make decisions on foreign policy.

With just two months until Election Day, national security has emerged as a centerpiece issue in the White House race. Both candidates believe they have the upper hand, with Clinton contrasting her experience with Trump's unpredictability and the Republican arguing that Americans worried about their safety will be left with more of the same if they elect Obama's former secretary of state.

While GOP candidates are often seen by voters as having an advantage on military and national security issues, Trump is far from a traditional Republican. He has no military experience and has repeatedly criticized the skill of the armed forces.

A flood of Republican national security experts have instead chosen to back Clinton, helping bolster her case that Trump is broadly unacceptable. Earlier Wednesday, former Defense Secretary William Cohen joined the list of GOP officials supporting Clinton.

Ahead of the forum, Trump rolled out a new plan to boost military spending by tens of billions of dollars, including major increases in the number of active troops, fighter planes, ships and submarines.

His address earlier in the day also included plans to eliminate deep spending cuts known as the "sequester" that were enacted when Congress failed to reach a budget compromise in 2011. Republicans and Democrats voted for the automatic, across-the board cuts that affected both military and domestic programs, though the White House has long pressed Congress to lift the spending limits.

Trump expressed support for the sequester in interviews in 2013 — even describing them as too small — but seemed to suggest at the time that military spending should be exempt.

A senior adviser said ahead of the speech that Trump would make sure the additional spending was fully paid for but did not explain how.

The United States currently spends more than $600 billion a year on the military, more than the next seven countries combined.