"We reserve the right to keep all options on the table," US Defence Chief Mark Esper said.

New US Defense Secretary Mark Esper picked his way through a political minefield in his first public meeting with the media Wednesday, skirting anything that could irritate his irascible boss President Donald Trump.

Just hours after predecessor James Mattis wrote that Trump's policies toward US allies are damaging US security, the new Pentagon chief hewed the official line, undoubtedly aware that the US leader studiously watches and assesses his cabinet members' televised performances.

For most of two years Mattis avoided appearing on camera, knowing that speaking his mind could only worsen a tense White House relationship rooted in fundamental disagreements over US defense policy.

Mattis resigned late last year.

Esper, a close ally of Secretary of State Mike Pompeo -- now Trump's primary national security advisor -- made clear he would not rock the boat, even given the president's unorthodox policymaking and sharp turns in longstanding US defense principles.

'All options on the table'

He didn't blink when asked about Trump's disturbing assertion that the US military could easily settle the Afghanistan conflict.

"We could win that war in a week if we wanted to fight it, but I'm not looking to kill 10 million people," Trump said last week, echoing similar comments he made previously and which led to speculation that only nuclear weapons could quickly eliminate such a large number.

"We reserve the right to keep all options on the table," Esper said.

"We're hoping that we can reach some kind of conclusion that could result in a political agreement" and bring peace to the country, he said.

Esper also smoothly took up Trump's apparent about-face toward Iran, whom he designated the premier US enemy after taking office in January 2017.

Trump said on Monday he was willing to sit down and negotiate with Tehran's leaders, after an offer to arrange a summit by French President Emmanuel Macron.

"We hope that the Iranians would agree to meet and talk and help us resolve these issues,"

Esper told reporters.

China is main US rival

In laying out the basis of his policies, he highlighted China as the foremost strategic rival to the United States, while making only the slightest reference to Russia, which Trump sees as a potential partner.

He meanwhile highlighted the launch Thursday of the Pentagon's US Space Command, a pet Trump project that Mattis opposed as unnecessary.

"The United States Space Command is the next crucial step towards the creation of an independent space force as an additional armed service," Esper said.

A classmate of Pompeo's at the US Military Academy at West Point, Esper served in the military for several years and then joined the defense industry, becoming an executive of leading Pentagon supplier Raytheon.

As Army Secretary under Mattis he was closer to Pompeo and avoided the policy fights Mattis had with the White House.

Not Trump's first pick to lead the Pentagon, he nevertheless got the president's blessing when he was sworn in on July 23.

"There is no one more qualified to lead the Department of Defense," the president said.

Trump's shifting policies

But his tenure could be easier: Trump has already appeared to slightly back off the hardline Iran policy that Mattis disagreed with, and likewise has moved to take denuclearization talks with North Korea more slowly, as Mattis had reportedly counseled.

In addition, a policy Mattis resigned over -- pulling out of Afghanistan -- is now well underway in negotiations with the Taliban, and Esper could not likely reverse the process if he wanted.

Yet in a Wall Street Journal opinion piece published Wednesday, Mattis highlighted perhaps the foremost challenge his successor has in serving Trump.

He assailed Trump for shredding US alliances, days after the G7 summit showed the president out of step with America's major partners.

"An oft-spoken admonition in the Marines is this: When you're going to a gunfight, bring all your friends with guns," Mattis wrote in The Wall Street Journal, giving his first public comments since quitting the Pentagon.

"A leader must display strategic acumen that incorporates respect for those nations that have stood with us when trouble loomed," Mattis wrote.

"Nations with allies thrive, and those without them wither. Alone, America cannot protect our people and our economy."