ANALYSIS: What we learned from Defense Secretary James Mattis' 2nd trip overseas Mattis is not afraid to break with Trump.

 -- On his second overseas trip, to Europe and the Middle East, as secretary of defense, James Mattis did much of what he did on his first trip: reassure U.S. allies.

He attended the NATO Defense Ministerial in Brussels and the Munich Security Conference, telling European officials again and again that the U.S. supported NATO and was committed to European security. He also made a surprise stop in Baghdad to meet with Iraqi officials and to get an update on the fight against ISIS.

There were moments when Mattis echoed President Trump's familiar lines — that NATO members need to spend more on defense and that military leaders should not divulge their battlefield strategies. But at times, Mattis was forced to downplay or flat out deny statements made by Trump that rattled U.S. partners overseas.

Trump has constantly praised Mattis and shown he will defer to him, for instance on reinstating torture techniques. So while Secretary of State Rex Tillerson, on his first overseas trip, appeared hamstrung by a White House that has left him out of the loop, Mattis appeared more sure-footed and willing to speak his mind on the world stage.

Here are the big takeaways from the secretary of defense's trip to Brussels, Munich and Baghdad.

The US supports NATO, but members need to pay their fair share

In Brussels during NATO meetings and at the Munich Security Conference, Mattis reaffirmed that the Trump administration fully supports NATO.

As recently as January, in an interview with The Times of London, then-President-elect Trump repeated his view that NATO is "obsolete," raising doubts about whether the U.S., under his leadership, would jump to the defense of its NATO allies in Europe if Russia attacked them.

"The alliance remains a fundamental bedrock for the United States," Mattis said in a joint statement with NATO Secretary General Jens Stoltenberg in Brussels. "As President Trump has stated, he has strong support for NATO."

But Mattis emphasized the need for NATO members to spend more on defense — a view Trump expressed frequently on the campaign trail.

NATO recommends that member countries spend 2 percent of their gross domestic product on defense. Currently, only five members meet that goal: the United States, the U.K., Greece, Estonia and Poland.

“I owe it to you all to give you clarity on the political reality in the United States and to state the fair demand from my country’s people in concrete terms,” Mattis said in Brussels. “America will meet its responsibilities, but if your nations do not want to see America moderate its commitment to the alliance, each of your capitals needs to show its support for our common defense.”

“No longer can the American taxpayer carry a disproportionate share of the defense of Western values,” he added. “Americans cannot care more for your children’s security than you do. Disregard for military readiness demonstrates a lack of respect for ourselves, for the alliance and for the freedoms we inherited, which are now clearly threatened.”

It's a strong message that Stoltenberg is publicly backing. During a press conference, he was asked about Mattis' remarks and if they mean the U.S. will back away from security commitments if members don't pay up.

"Secretary Mattis clearly stated that the U.S. expects Europe and Canada to invest more in defense and if that doesn't happen, then we'll have a chat, but I think we should not speculate on what will happen if we don't deliver and focus on delivering what we have promised. We are starting to move in the right direction. We stopped cuts in 2015 and increased in 2016. I welcomed the firm message from Mattis because it increases all eyes on neighbors what they have promised in 2016," he said.

Baghdad has a friend in Mattis

In a press conference with U.S. Gen. Stephen Townsend, the commander of the coalition's fight against ISIS, Mattis praised the Iraqi military as one "that can fight as truly valiantly as this one has" in spite of high casualties. He spoke fondly about returning to Iraq after years of fighting "alongside each other through good times and bad times."

He would neither commit to nor deny a willingness to send more troops or equipment to Iraq but said the Iraqi military has the coalition's "full support." He also assured allies that ISIS will be destroyed.

"They are going to be shown to be exactly what they are, which is a bunch of murderous relics, to put it bluntly," Mattis said.

Mattis' surprise visit to Baghdad coincided with the launch of a major offensive by Iraqi security forces and coalition partners to take full control of Mosul from ISIS.

Trump brought up Mosul in his press conference on Thursday when asked whether he would respond to recent Russian provocations.

"I'm not going to tell you anything about what response I do. I don't talk about military response. I don't say, 'I'm going into Mosul in four months. We are going to attack Mosul in four months.' Then three months later, 'We are going to attack Mosul in one month. Next week, we are going to attack Mosul.' In the meantime, Mosul is very, very difficult. Do you know why? Because I don't talk about military, and I don't talk about certain other things, you're going to be surprised to hear that," he said. "And by the way, my whole campaign, I'd say that. So I don't have to tell you. I don't want to be one of these guys that say, 'Yes, here's what we're going to do.' I don't have to do that. I don't have to tell you what I'm going to do in North Korea."

The U.S. military announced in a press release on Sunday that Iraqi security forces began an operation to liberate western Mosul. But like his boss, Mattis wouldn't go into details about providing additional troops and equipment or whether the U.S. would arm Kurdish forces.

"We'll accommodate any requests from the field commanders," he said.

"We owe some degree of confidentiality on exactly how we're going to do that and the sequence in that fight so we don't expose to the enemy what it is we have in mind in terms of the timing of operations," Mattis added.

Mattis is not afraid to break with Trump

There were several times on this trip that Mattis broke with the president.

Mattis was asked if he agreed with Trump's Friday night tweet declaring the media "the enemy of the American People!"

"I've had some rather contentious times with the press, but no, the press, as far as I'm concerned, are a constituency that we deal with, and I don't have any issues with the press myself," Mattis replied.

While in Iraq, he flatly denied Trump's controversial statements about possibly seizing Iraq's oil.

"We're not in Iraq to seize anybody's oil," Mattis said.

Trump told ABC News' David Muir just days after taking office, "We should have kept [Iraq's] oil. Maybe we'll have another chance. We should have taken the oil. You wouldn't have ISIS if we took the oil."

Mattis provided insight into Trump's revised travel ban before its release.

Iraq was one of the seven countries targeted by the original executive order, which meant Iraqi interpreters who had served with the U.S. military were suddenly unable to enter the United States, despite obtaining special immigrant visas. There was an outcry from some members of Congress and veterans' groups who were outraged that Iraqis who had risked their lives for America were left in danger.

"I have not seen the new executive order, but I right now am assured that we will take steps to allow those who have fought alongside us, for example, to be allowed into the United States," Mattis said. "They will have been vetted, obviously, by their performance on the battlefield beside us and by the normal procedures, and I'm sure we will work our way through this quickly."

At the recommendation of the Pentagon, the Trump administration amended the travel ban on Feb. 2 to allow Iraqi interpreters and their families to enter the U.S. A revised version of the original travel ban, which was blocked by court order, is expected to be released by the administration this week.

The FAKE NEWS media (failing @nytimes, @NBCNews, @ABC, @CBS, @CNN) is not my enemy, it is the enemy of the American People!

"I've had some rather contentious times with the press, but no, the press, as far as I'm concerned, are a constituency that we deal with, and I don't have any issues with the press myself," Mattis replied.

While in Iraq, he flatly denied Trump's controversial statements about possibly seizing Iraq's oil.

"We're not in Iraq to seize anybody's oil," Mattis said.

Trump told ABC News' David Muir just days after taking office, "We should have kept [Iraq's] oil. Maybe we'll have another chance. We should have taken the oil. You wouldn't have ISIS if we took the oil."

Mattis provided insight into Trump's revised travel ban before its release.

Iraq was one of the seven countries targeted by the original executive order, which meant Iraqi interpreters who had served with the U.S. military were suddenly unable to enter the United States, despite obtaining special immigrant visas. There was an outcry from some members of Congress and veterans' groups who were outraged that Iraqis who had risked their lives for America were left in danger.

"I have not seen the new executive order, but I right now am assured that we will take steps to allow those who have fought alongside us, for example, to be allowed into the United States," Mattis said. "They will have been vetted, obviously, by their performance on the battlefield beside us and by the normal procedures, and I'm sure we will work our way through this quickly."

At the recommendation of the Pentagon, the Trump administration amended the travel ban on Feb. 2 to allow Iraqi interpreters and their families to enter the U.S. A revised version of the original travel ban, which was blocked by court order, is expected to be released by the administration this week.