Igor Mitrovic, MD, arrived at the JFK airport in New York on Dec. 24, 1991, a refugee from a country that was sliding into chaos.

Just out of medical school, he had come to join his wife. But he looked young and spoke broken English, and a customs agent didn’t believe he was a doctor or that he was married.

They were about to send him back, when another agent passed by, smiled broadly and said, “Oh, man, let him go! It’s Christmas Eve!”

So began Mitrovic’s unlikely journey from Yugoslavia, where he grew up in a small Croatian town wanting to be a family physician, to UC San Francisco, where he became a respected neurobiologist and a beloved teacher.

This year, medical students chose the 47-year-old Mitrovic to give the “Last Lecture,” the annual campus rite in which a faculty member is asked to deliver the lecture he’d give if it were his last.

Mitrovic called his April 16 talk, “Dreams, People and Lessons, in no Particular Order.” But there was an order, and it drew from his unwavering desire to learn from whatever life handed him, which, in his case, was a lot.

Mitrovic said the key to real success was knowing how to deal constructively with setbacks. “One isn’t defined by one’s failures, but by what one does after one’s failures.”

Of course, many things were beyond his control – such as the loss of his country, which exploded into civil war. He escaped the violence, but new challenges awaited in his adopted country. Resettling in Chicago then San Francisco, Mitrovic struggled to find his true purpose in life.

He excelled in science, but the high-stakes enterprise of being a principal investigator was not for him. Then, in quick succession, came a series of health problems: back surgery, pneumonia, osteoarthritis and portal vein thrombosis, a painful condition in which a blood clot forms in the main vein feeding nutrients from the gastrointestinal tract to the liver.

Yet, no matter how openly Mitrovic spoke of his struggles, he never seemed defeated. His stories were funny and his spirit irrepressible.

Trusting, idealistic and endlessly curious, the young Igor could also be careless. Mitrovic invited the students to laugh along with him at his younger self, which they did.

Mitrovic recalled the time a professor threw him out of an oral exam after asking just one question: “What is cholesterol?” Igor had studied so hard he was sure he would ace the exam.

But he hadn’t done the one thing necessary to answer the question: attend that professor’s lectures. Flashing a slide of the chemical composition of cholesterol labeled, “The Murder Weapon,” Mitrovic recalled how his more studious friend, Marta, told him the professor had repeatedly told the class, “Cholesterol is an alcohol.”

Marta, it turned out, provided Igor with endless opportunities for learning. They roamed the streets of Zagreb for hours, talking about everything under the sun and satisfying each other’s deep curiosity about literature, psychology, philosophy and more. Not long after, the two married.

They emigrated and had a son, named Dmitri. There were career struggles and a deep quandary over what he was really meant to do with his talents.

And, finally, the dawning realization that he should do what he really loved, which was teach. He worried about disappointing his mentor, Allan Basbaum, PhD, who had invested in him. Until finally, he realized, it wasn’t the mentor’s job to dictate a trainee’s future.

“Great mentors listen,” Mitrovic said. “They try to understand. They challenge you. But they support.”

Now, in addition to his role as director of physiology training across all the four schools, Mitrovic does a lot of mentoring himself, helping graduate students and postdoctoral fellows learn how to mentor others.

But finding his way in the world didn’t necessarily help him when he got sick. Four weeks of the blood thinner heparin had more or less taken care of the portal vein thrombosis, but afterward he was debilitated with depression and panic attacks.

“Even though I knew my purpose, I was afraid of dying.”

Slowly, it dawned on him: Everything dies, not just people but all living things, “even stars, galaxies, perhaps even the universe.”

Maybe, he thought, his own existence wasn’t so central after all. From a certain vantage point, it even seemed random. “Heck, there was one particular sperm out of god knows how many,” he said as everyone burst into laughter. “Here I am.”

And since he was here, he figured he should try to live his life as well as he could. “I had to surrender and trust and remember that whatever comes, I am the only one who is living.”

Now, he had a sense of purpose that included the possibility of his own demise.

“I realized that I am a part of something much greater. Every atom in my body was forged in a star. Imagine how wonderful it is to realize this.”

When he was finished, everyone rose to their feet with applause and cheers. A clutch of students enveloped him in a group hug and gave him flowers.

After the lecture, the congratulatory emails flooded in. One came from a student who wrote, “There is no weakness in supposed ‘failure’ or ‘imperfection.’ In fact, you have demonstrated how we can draw strength from it all.”

This article first appeared on the UCSF website.