You didn’t get the promotion. Your mortgage application was denied. Your phone pings with a text, “I think we should see other people.”

When setbacks like this occur, it’s natural to try and soothe your ego by seeking a new win. “I’ll show them! I’ll get a better job, a nicer house, a more beautiful partner!”

There’s nothing wrong with going after what you want, but Ohio State University psychologist Jennifer Crocker says that merely focusing on achievements and approval from others is a shaky path to self-esteem.

“Even if you conclude at the moment ‘Yes I’ve been successful in my field. I’ve been honored. I have value,’ what about tomorrow when my grant proposal gets rejected? It isn’t a reliable source of satisfaction or meaning in life,” said Crocker.

Fortunately, Crocker’s research has uncovered a far more sustainable method. She and her colleagues found that people who derive their self-worth from internal sources—such as being kind, or living by one’s values—have better relationships and greater mental well-being (less anxiety and depression, lower rates of drug and alcohol consumption) than those who rely on external sources like good grades or popularity. Here are suggestions for creating a sturdier sense of self-worth.

Give yourself a higher purpose

In one study, Crocker found that the more students based their self-esteem on academic performance, the more prone they were to anxiety and depression. And this self-pressure didn’t even lead to better grades.

“They were stressed out, felt they had no time for leisure, were dissatisfied with their performance, but their grades were not higher,” said Crocker. “They worked very hard and [the need for self-esteem] motivated them on some level, but not in a way that did them any good and probably did some harm.”

However, students had a much better experience when they focused on the purpose of their studies—to make a contribution to scientific research, for example.

“We need to stop worrying about our self-esteem. If we did, we would actually have higher self-esteem.”

“Having the goal to contribute to the well-being of people or institutions or circumstances outside of yourself makes it not about you. The question to ask is not, ‘Do I have worth or value?’ The question is, ‘What is the difference I’m making in the world?’” said Crocker.

Making a difference in the world doesn’t have to mean finding a cure for cancer; it could be as simple as shifting your focus at work. For example, instead of trying to win a new account to prove to what a great salesperson you are, think about how your success would benefit the rest of your team—by making the company more financially stable and providing more job security for everyone.

Focus on other people

Another study, conducted by Amy Canevello and Crocker, tracked the self-esteem of college roommates. The students answered questionnaires to determine whether they were primarily focused on “compassionate goals”—supporting their roommates, being sensitive to their feelings—or whether their main concern was their roommates’ opinion of them.

The research found that students who had more compassionate goals had higher self-esteem and better relationships with their roommates than those who had more ego-related goals. In fact, the self-esteem of the participants with compassionate goals actually rose throughout the semester—and so did their roommates’.

“When people have compassionate goals, others reciprocate that support so both people benefit,” said Crocker, who added that this can create a virtuous circle where the people in your life are inspired to be more supportive and responsive to others around them. “So you kind of become the source of compassionate goals in your social system,” she said.

Crocker says evidence supports that setting goals that focus on helping others has numerous benefits. These goals predict­ (rather than just correlate with) higher psychological well-being, reduced symptoms of anxiety and depression, improvements in friendships and romantic relationships and increases in self-esteem.

“We are finding tremendous benefits,” she said. “That is not to say you are going to be more successful, make more money, get higher grades or be more beautiful when you have compassionate goals, but the quality of your life is going to be very different.”

That difference, she explained, is rooted in the fact that it requires shifting your focus away from yourself and onto others—be they the beneficiaries of the charity you support, or the friend who is feeling down and needs someone to listen.

“We need to stop worrying about our self-esteem,” said Crocker. “If we did, we would actually have higher self-esteem.”