Patrick Shanahan has a message for the next generation of naval officers: what doesn't kill you only makes you stronger.

Speaking at the Naval Academy's commencement ceremony in Annapolis, Maryland on Friday, the acting defense secretary and former Boeing executive encouraged members of the Class of 2019 to embrace the mantra of Japanese samurai in their service to the United States.

“If you ever studied the Samurai culture in feudal Japan, you know the most feared, most dangerous of all Samurai were those who had felt the cut of their opponent's sword, and lived to fight the next battle,” Shanahan said. “Why? Because they no longer feared the sword! They could – and would – press the fight, knowing the danger but unafraid of it.”

While the ensigns and lieutenants he addressed likely won't rush into battle with their sabers at the ready anytime soon, Shanahan argued that this principle is alive and well in the Silicon Valley, where Facebook founder Mark Zuckerberg's mantra of “move fast and break things” has become innovation gospel.

“Today in Silicon Valley, the major private equity investors don't usually put their fortunes behind the smartest young people,” Shanahan said. “They look for seasoned entrepreneurs who have gone bankrupt before; who have failed. Why? Because those people know where they went wrong. And they are smarter, wiser, less arrogant, and more capable than those who have never failed.”

“If you have never experienced failure; if you have not felt the cut of the blade, then when failure finds you — you won't know how to recover,” he added.

Read Shanahan's full remarks below:

Thank you, Vice Admiral Carter. Secretary Spencer, Chief of Naval Operations Admiral Richardson, Commandant of the Marine Corps General Neller, ambassadors, distinguished guests, all faculty and alumni, thank you for joining us on this special day.

To the families and friends here today – moms and dads, brothers and sisters, aunts, uncles, grandparents, loving friends – would you please stand?

This day belongs to our graduates, but it was made possible by your countless sacrifices, day-in and day-out over many years.

Thanks to you, your sons and daughters are people of character, selfless citizens ready and willing to serve our country – the best of the best.

You did your job with them, and you did it brilliantly.

So, I now invite our Midshipmen to please rise and render appropriate honors to your family and friends in loud Navy fashion!

Please be seated.

Now, most importantly, to our soon-to-be Ensigns and Second Lieutenants, the U.S. Naval Academy Class of 2019:

Let me offer my sincere congratulations.

Since you first arrived on The Yard, you have excelled: from academics and athletics, to sea trials, to summer trainings, to truly difficult tasks…

Like scaling the Herndon Monument in 1 hour, 12 minutes, and 30 seconds… Midshipman Chris Bianchi, well done!

We could speak for a long time on all you have achieved… But you'd learn little from such a talk. You'd feel good, but that is not my intent.

I need you to learn and be better than yesterday every day. So, I am not going to waste your time.

The class of 2019 will do amazing things. I guarantee it.

You will make your friends, your family and your country proud.

But today, I want to speak on the topic of failure. Yes, failure.

For such a successful class, failure is largely an abstract concept, something for others to consider and deal with.

From what I understand from the Superintendent, the experience of failure is unfamiliar to many of you. And to a greater extent than you might realize, that is a liability.

If you ever studied the Samurai culture in feudal Japan, you know the most feared, most dangerous of all Samurai were those who had felt the cut of their opponent's sword, and lived to fight the next battle.

Why? Because they no longer feared the sword! They could – and would – press the fight, knowing the danger but unafraid of it.

Somewhat similarly, today in Silicon Valley, the major private equity investors don't usually put their fortunes behind the smartest young people.

They look for seasoned entrepreneurs who have gone bankrupt before; who have failed. Why? Because those people know where they went wrong. And they are smarter, wiser, less arrogant, and more capable than those who have never failed.

If you have never experienced failure; if you have not felt the cut of the blade, then when failure finds you – you won't know how to recover.

It will crush your image of yourself. It will hurt too much. It will be embarrassing. It will stop you from becoming who you could be.

It could turn you into someone who avoids putting themselves on the line because they do not want to fail again… Someone who looks for the easier tasks.

Worse, you might be tempted to avoid important future situations with low probabilities of success for fear of receiving a black mark on your record.

You must resist that temptation. Kill that fear.

The U.S. Navy and Marine Corps exist to fight, not simply to stay in position. And to paraphrase Class of '23 alum Admiral Arleigh Burke, when the time comes to fight, “…you'd better know how.”

Your country and this department need Naval officers who don't simply identify problems, but roll up their sleeves and get really hard stuff done:

At midnight on the high-seas in fifty-foot swells…

Or in earth's harshest environments, against unforgiving enemies.

While we always expect you to strive for excellence, the zero-defect mentality is a handicap we simply cannot afford. It is something you cannot afford. It will not lead you to greatness, but to mediocrity.

So, if you'll bear with me, today, I'd like to offer some thoughts on how to “get into the game” and move past that very natural human tendency to avoid challenges that might result in failure.

My first piece of advice is this: when the project or mission appears slated for failure – stay the course, find a better path, and don't you dare quit. Real opportunities for greatness reveal themselves when things seem at their darkest.

Easy to say, “Don't quit.” But by now, you've learned the hard truth: Many people cannot handle the pressure of being close to failure and staying the course. Rather than look for creative solutions, their energy turns to finding a way to avoid blame.

Let me tell a quick story.

In 1997 – likely when most of you were born, I was relatively early in my career. But I was succeeding, and I was being put on the “fast track.”

I was asked if I would leave my senior leader position at a plant that was enormously successful and move to an operation at a different site that was failing spectacularly.

Production troubles were unprecedented. Costs were soaring, suppliers weren't delivering, and we were way behind schedule. The company reported its first annual loss in 40 years. It was a terrible situation.

I had the option to say “No.” But, I said “Yes” because I wanted to test my mettle. I wanted to know if I could, as a relatively young person, really make a difference.

Managing the operation was grueling. We worked tirelessly every day for 12-18 hours a day. Coming home, I would pull off the road to sleep for a few minutes as I was too tired to drive.

Still, progress was unsatisfactory to my managers.

And then, somebody threw me a lifeline, probably to save my career: a chance to switch jobs, to dodge association with failure.

Against most of the advice I received, I decided to stay and I am so unbelievably glad I did – despite the black mark it brought on my record, despite the embarrassment.

For the first time in my life, I came to understand why the captain goes down with his ship: because the mission matters more than he does.

You Midshipmen learned that “Mission First Mindset” here at Annapolis from the moment you arrived. Guard that mindset when you go into the Fleet.

Because a day will come when you are tempted to protect your career at the price of accepting a hard mission or of seeing it through.

On that day, remember that Herndon Monument is only there because Commander Herndon chose to go down with the SS Central America.

For me, the experience at that struggling plant also taught me to get comfortable being uncomfortable – to take heat.

Taking tougher projects became easier. I could focus on the work, without worrying about what my superiors might think about me.

This is a critical mindset, and it gets harder to grow the higher up you go. So, start early.

Pick early assignments that will stretch and prepare you for the day when it really matters.

There will always be hard jobs nobody wants for fear it will make them look bad. Seek them out.

The definition of grit is the ability to do something extremely hard for a prolonged period of time. Get grit.

In a proverbial sense, we will need you to go 15 rounds with Mike Tyson – every day.

The good news is…after a couple weeks, you aren't afraid of Mike Tyson anymore.

Once you lose that fear; once you really internalize that it's not about you, but about the mission, then the shadow of your leadership reaches across your team and inspires them not to lose hope when times are dark. That is greatness.

And … I'll let you in on a little secret: when you put the mission before your career, your career is far more meaningful.

When you face a choice between mission and self, you won't even hesitate. Your confidence will be unwavering.

The second lesson applies when you find failure at a broader, organizational level… when the status quo simply won't work.

When that happens, “Think… don't copy.” What does that mean?

Failure often manifests itself when people become too comfortable replicating what worked in the past.

In an era of renewed Great Power Competition, with massive changes driven by new technology, we simply cannot replicate what worked in the past.

In business, when companies fail to adapt, they go bankrupt. In national security, when militaries fail to adapt, they lose wars – hot and cold.

Market forces are brutal, efficient, and unavoidable. Don't think for a minute they don't apply in the military. The enemy gets a vote.

To some extent, history can be your guide, but the world isn't static.

The complexity is far, far greater now than it was for your predecessors. The time constant for change is short and getting much shorter.

In national security, these rapid technological advances, from AI to hypersonics to space, mean you will face completely new challenges, things you have never trained for.

Threats that don't exist yet will show up on your watch.

In this environment, you are going to be asked to do jobs for which there will be no instruction manual; no precedent; no one to call who knows how to do it any better than you.

You have been taught the human elements of leadership here at the Academy; these are the core foundational elements of success and they do not change over time. You have that inside you.

But your ability to make difficult organizational changes will be required for our effectiveness and survival.

This was brought into perspective for me by a CEO in a top 10 Fortune 500 company who said, “The job of being CEO that I trained for no longer exists.”

For those of you who can master this, leading change in the future will be an opportunity.

Consider this: when Admiral Rickover graduated from the Academy, the U.S. Navy powered its ships with steam. Scientists hadn't yet split the atom.

But the “Father of the Nuclear Navy” recognized applications of that innovation, and he spearheaded the change in naval propulsion.

There was no one for Hyman Rickover to copy.

We will need you to come up with innovative solutions to complex, rapidly evolving problems:

From secure, reliable communications with autonomous submersibles to electrical architectures aboard surface ships, to “fighting in the dark” without the aid of legacy comms systems that previous graduates took for granted.

Some days, you'll need to be Hyman Rickover.

Other days, it's okay to be MacGyver, using paperclips and duct tape.

Just remember, it is okay to ask: Is this a situation where my commanding officer knows something I don't? Or do I need to exercise initiative – consistent with my oath as an officer?

The heavy lifting of changing the status quo as we move to meet this era of Great Power Competition has begun. You will inherit our work of reshaping the department, strengthening our alliances, and reforming our management practices.

So, have a keen eye that can see what “better” looks like.

Don't be afraid to buck the system so we have what we need to fight and win.

Think – don't copy.

The last lesson applies when you encounter ethical failure – and you will. When that happens, “Stand your ground.”

In a few moments, you will become graduates of an Academy with the mission of “developing Midshipmen morally, mentally and physically and to imbue them with the highest ideals of duty, honor and loyalty.”

You came to this institution from all across our vast and diverse country. You are a microcosm of America…you are also the best of America.

If you do not stand your ground on ethical principles, on excellence in your team, then who can we rely upon to do that?

When you see ethical failure – in uniform or out, by military members or others – you must become gravity. You and your commitment must be unshakable, regardless of the circumstances.

The easiest person to stand against is the enemy. The toughest person to stand against is your teammate.

You'll have countless opportunities to do this across your career: let me tell you where you can make a mark on our Department right away.

I need you young Lieutenants and Ensigns to set the standard on preventing sexual harassment and assault in our ranks. The status quo won't cut it.

You are perfectly postured to make that impact: you are parachuting into the front lines.

Set the climate. Model and teach the right behaviors of respect, good order, and discipline. Call it out. Lead. Motivate. Inspire.

Coach up. Transform our Navy and Marine Corps. Make them the institutions they were made to be. Set the example for your subordinates, peers, and leadership.

Learn to be comfortably uncomfortable with this responsibility, drawing confidence from the knowledge that, when we are aligned on one goal, we're unstoppable.

Sexual assault and harassment degrades the dignity of our teammates, and we are on the side of personal dignity in this era of renewed Great Power Competition.

We stand against authoritarian regimes that routinely degrade human dignity for their very survival.

Remember, we are the good guys. So hold fast to those highest ideals of “duty, honor, and loyalty” and stand your ground.

Before closing, let me once again address the family and friends:

I have a pledge to make to you.

As we approach Memorial Day, we remember the ultimate price paid by some of the predecessors of the class of 2019.

In my capacity, the most difficult decision is authorizing a mission that I know puts the men and women of our Armed Forces in harm's way.

I will continue to give those orders, but only when absolutely necessary. I may have to put your loved ones – those sitting in front of us today – in harm's way. You know this, and they know this.

My pledge to you and to each of these incredible men and women, and to my Commander in Chief, is this:

I will do whatever it takes to ensure those missions make the difference to keep our country safe and free.

And I promise to the best of my ability to provide them with whatever they need to be successful.

That is my commitment, and you can hold me to it.

Finally: I want to close with an old adage: “A ship in port is safe, but that's not what ships were built for.”

We live in troubled times: from Chinese and Russian malign activity to that of rogue states, the list of world woes is long.

We are going to send you out among them.

Are the challenges serious? Yes.

Do they require all that is best within us to meet, deter, and if necessary, defeat them? Yes.

Do we have any doubt in our ability to do this? None whatsoever.

Not as long as you are willing to stay the course, to think and not merely copy, and to stand your ground.

Remember who you are: Sailors and Marines of the U.S. Navy and Marine Corps. You are guardians of the best of our American heritage and traditions.

That heritage includes individual freedom, the universal dignity of all human beings, freedom of speech, and freedom of religion.

These ideals do not live on their own in the world. Your predecessors have guarded them for the last 243 years. Now, it's your turn.

Around the world, your shipmates are waiting to receive you into their ranks. You are joining the finest, most feared Navy and Marine Corps Team in the world. Keep it that way.

Soothe our Allies and Partners. Frighten the hell out of our foes.

Know of our gratitude for all that you will accomplish in the days to come.

Congratulations to the Class of 2019, God bless you, our Navy, our Marine Corps, and the United States of America.