In an exclusive interview Thursday with "Fox News @ Night," Department of Homeland Security (DHS) Secretary Kirstjen Nielsen praised Defense Secretary James Mattis' work on border security, just hours after he announced his sudden resignation.

Mattis, whose departure will take effect Feb. 28, "has proved to be an incredible partner" to DHS on a variety of matters, including cybersecurity and counterterrorism, Nielsen said.

"We've signed a monumental memorandum agreement between our two departments to work on cybersecurity together. He certainly has been very supportive of our border security mission," Nielsen told anchor Shannon Bream.

CLICK HERE TO GET THE FOX NEWS APP

In October, the Pentagon announced that nearly 6,000 troops would deploy to the U.S.-Mexico border to confront an approaching migrant Central American caravan. Earlier this month, Mattis signed an order keeping some troops in California, Arizona and Texas through January.

Nielsen added that Mattis had helped "with our counterterrorism mission, as we look to fight the terrorists abroad so they don't come here." She called him a vital asset to the DHS' "home game and away game."

Mattis' resignation came a day after President Trump announced plans to pull all 2,000 American troops out of Syria -- a move that top Republicans said would endanger Syrian Kurds allied with the U.S. and enable the Islamic State group (ISIS) to regain a foothold in the country.

And on Thursday, a senior U.S. official told Fox News that Trump is seriously considering a “significant drawdown” of U.S. troops stationed in Afghanistan -- a position former President Barack Obama had championed in 2012.

In his resignation letter, Mattis told Trump he has "the right to have a Secretary of Defense whose views are better aligned" with his own.

CALIFORNIA COPS 'FRUSTRATED' BY SANCTUARY CITY LAWS ENDANGERING THE PUBLIC, OFFICERS

"I have complete admiration and respect for [Mattis] and have so enjoyed working with him," Nielsen said.

Separately, Nielsen asserted that the border wall proposed by the Trump administration would effectively cut down on crime and illegal immigration.

On Thursday, Trump insisted on a spending bill that includes $5.7 billion in funding for that wall. If Congress doesn't pass such a bill -- or if Trump vetoes a spending bill over a lack of funding for the wall -- the federal government will shut down Friday.

"Well first, I would just say, 'Walls work,'" Nielsen said. "We know they do. We have seen it in San Diego, we've seen it Yuma, everywhere we have that physical infrastructure."

Nielsen added: "We see illegal immigration drop by 95 percent. The president will continue to advocate for what the men and women of the Border Patrol say they need. And this is what it is. It's a physical infrastructure along with the technology and personnel that go to it."

The DHS head also touted the agreement the U.S. secured with Mexico early Thursday so that immigrants claiming asylum will be returned to Mexico as their cases are processed -- a bid to end the practice known as “catch-and-release.”

"What we did is we took this as unilateral action under our statutory authority, but of course we have let the Mexicans know we were going to do it -- we've been having discussions for quite some time," Nielsen said.

As a product of those discussions, Nielsen said, immigrants will be afforded the opportunity to gain work permits in Mexico, educational and medical resources, and the ability to apply for asylum there.

"For those who really need asylum, we encourage them to do it as soon as possible in that journey," Nielsen said, adding that she was "optimistic" about the new arrangement being legally formalized soon.

At an explosive hearing earlier Thursday, Nielsen sparred with U.S. Rep. Luis Gutierrez, D-Ill., on immigration policy, after he openly called her a liar.

"Shame on everybody that separates children and allows them to stay at the other side of the border fearing death, fearing hunger, fearing sickness," Gutierrez said. "Shame on us for wearing our badge of Christianity during Christmas for allowing the secretary to come here and lie."

Nielsen shot back: "Calling me a liar is fighting words. I'm not a liar, we've never had a policy for family separation."

A family separation policy, Nielsen added, "would mean that any family that I found at a port of entry I would separate, it would mean that every single family that I found illegally crossing, we would separate. We did none of those."

Nielsen added that DHS was merely enforcing existing immigration laws that incidentally led to increased family separations due to a Clinton-era consent decree, but Gutierrez didn't hear her full reply. He pointedly left the hearing room as she spoke.

"It's not appropriate, it's not professional is accurate," Nielsen told Bream, referring to Gutierrez's comments. "But secondly, again, we had no policy to separate families. ... If the parent has committed a crime and needs to be taken to a criminal area where we wouldn't want to take a child, or if the person is not related to the child," it is necessary to separate them, Nielsen said.

"The law says if you come here illegally, it's a crime," she continued. "That's what we did. We tried to enforce the law."