In the hours following Justice Ruth Bader Ginsburg’s death on Friday evening, thousands of mourners flocked to the Supreme Court, a pilgrimage propelled by raw grief. Many sang and lit candles; they cried together, and hugged. They gathered again the next night, and the next. They’ll return as she lies in repose at the Supreme Court and in state at the U.S. Capitol.

We’ve seen similar outpourings of sorrow following the death of a public figure this year. It happened in Los Angeles, when those grieving basketball legend Kobe Bryant gathered outside the arena where he had played, leaving piles of flowers, basketballs and written messages. In Georgia, Alabama and the District, as crowds showed up to see Rep. John Lewis’s funeral processions. And on social media, as fans worldwide mourned the loss of Hollywood star Chadwick Boseman.

But grieving a public figure — someone we didn’t know personally — can be perplexing. Why are we so affected? And how can we — should we — deal with these feelings?

“I was sad all weekend,” said Sherry Cormier, a psychologist and bereavement trauma specialist based in Annapolis, Md. She related to a young woman interviewed on TV over the weekend who said, “I feel like Justice Ginsburg was my grandmother.” With some notable people, “We do almost feel like they’re our friend or our family member,” Cormier said. “We belong to them, and they belong to us, on some level.”

Still, grieving the loss of a public figure seems like it should be different than grieving for a loved one. We might feel selfish, or like we don’t have a right to mourn someone who was, in essence, a stranger. Publicly expressing our “grief” can feel awkward — and even overdramatic or unfair to the person’s real-life friends and family. Those around us might dismiss or minimize our anguish, brushing it aside as unwarranted.

But there are many different types of grief, and experts underscore that they’re all valid. Not knowing someone in person doesn’t preclude us from grieving for them, and not acknowledging how we feel can be harmful.

“Grief is not a matter of kinship — it’s a matter of attachment,” said psychologist Robert A. Neimeyer, who directs the Portland Institute for Loss and Transition. “And we’re quite capable of attaching to human beings, most particularly, but also to animals, things and conditions of the world. When all of these are lost, we can experience very significant grief. This is no less true when we’re speaking about someone we never met personally.”

Here are strategies for coping with the loss of someone whose presence mattered to you, whether you knew them in person or not.

Name what you’re feeling. The grief we feel for a public figure is more of a “distanced grief,” as Cormier put it — we’re not one of the deceased’s intimate survivors. But it’s important to acknowledge our feelings, rather than push them aside to be dealt with another day. Say it out loud or write it in a journal: “I am grief-stricken.” “I’m heartbroken.”

“A lot of unrecognized grief will come out in other forms,” such as anger and depression, Cormier said. “It’s healthier to let it come out as sadness.”

She added that sometimes we grieve someone we didn’t know because it feels safer and less vulnerable than grieving our more personal losses. It can be cathartic — an outlet to express and process grief we’ve been stifling.

Remember that there’s no right or wrong way to grieve. Make grief a judgment-free zone. There’s no road map, and what feels helpful to one person won’t to another. While some people gain strength from public gatherings, others can’t stomach the thought. If posting social media tributes makes you feel better, go for it; if public displays of mourning are difficult for you to see, take a break from your apps.

“Grief is so highly individualistic,” said Rachel Brandoff, an art therapist with Thomas Jefferson University in Philadelphia who has expertise in bereavement. “Your needs for grief are different from my needs for grief. It’s not even predictable based on your own prior experience. How you were affected by a past loss, whether it was someone in your family or a celebrity, might not inform how you’re affected by this loss.”

Seek connection. Our brains are hardwired for social contact and sharing, and for many of us, that’s particularly true when we’re grieving. The vigils honoring Ginsburg, which have been replicated across the country, are one way to engage in a shared community experience.

David Fireman, executive director of the Center for Grief Recovery in Chicago, said his daughter, who lives in the District, sent him videos from the vigils at the Supreme Court. “I couldn’t help but think, ‘Wow, there it is. So many people, and for so many reasons, showing up for something like that.’ ” He noted that one definition of mourning is “public grieving.” “It has to do with solidarity” and feeling support and permission to grieve. “Because we as humans are social animals, we do much better when we’re bonded with one another in our losses, even when it comes to people we don’t know,” he said.

If you’re not up to attending an in-person vigil, reach out to a friend who will accept how you’re feeling and provide comfort. Or join an online support group with like-minded people.

Do something. Ginsburg was lauded as a trailblazer for women’s rights and justice. To celebrate her memory — and carry on her legacy — some Americans who mourn her will donate money to organizations they believe she would have supported. Others will use their grief as fuel to engage in activism. Doing something, anything, gives us a sense of agency. Even wearing a face mask bearing an image of Ginsburg, or one of her famous quotes, can help people feel like they’re carrying on her values and mission.

Look for opportunities to engage in collective projects, too. Brandoff highlighted the AIDS Memorial Quilt, a massive mosaic of tributes to more than 70,000 people who died of the illness, as one example. Participating in a shared grief ritual gives voice to the pain of losing someone, she said.

Make art or write a letter. Both are examples of healthy ways to express your grief. Even if you don’t think of yourself as an artist, draw or paint a picture of the person you’re mourning, or what they meant to you. Creativity provides focus, as well as an outlet for feelings we don’t otherwise know what to do with. Similarly, writing a letter or practicing free writing can lead to clarity and relief.

Distract yourself with self-care. When your emotions become too overwhelming, give your mind a break by tuning in to a favorite TV show, suggested Melissa Fisher Goldman, a licensed clinical social worker who specializes in grief. Or cancel your obligations and spend the day taking a walk, soaking in a bath or self-soothing in some other healthy, positive way. “We think, ‘Gosh, it’s not like my mom died, why did I have to take today off? Why am I so upset?’ ” said Goldman, who’s based in Orange County, Calif. “Well you are, so it doesn’t matter why. It’s a loss for you, and you’re having the emotion, so honor it.”

Know when to seek help. Psychotherapists in general — and grief counselors in particular — are trained to help people adapt to loss. There’s no shame in contacting a professional to talk through what you’re feeling. “If it’s becoming debilitating, finding help to work through that grief can be really important,” Brandoff said. “Even if you didn’t know Ruth Bader Ginsburg personally, what her loss represents in your life can still be enormous.”

Angela Haupt is a writer and editor based in the District. Follow her on Twitter @angelahaupt.