Facebook is giving users a way to keep their profiles updated after they die.

The new feature, launching first in the U.S., lets a user choose a "legacy contact" — a family member or friend who can log in for the user after Facebook gets a death notification. The legacy contact can do things like provide details about memorial services.

"We hope this work will help people experience loss with a greater sense of possibility, comfort and support," wrote product manager Vanessa Callison Burch, content strategist Jasmine Probst and software engineer Mark Govea in the Facebook newsroom Thursday.

The legacy contact feature is rolling out in the U.S. first, but Facebook has indicated it will expand to other countries. (Facebook)

Facebook users also have the option of having their accounts permanently deleted when they die.

Previously, when Facebook was notified of a user's death, his or her account would be converted to a "memorialized account" that could still be viewed, but couldn't be managed.

"By talking to people who have experienced loss, we realized there is more we can do to support those who are grieving and those who want a say in what happens to their account after death," the Facebook blog post said.

Once Facebook has been notified of a user's death, the chosen legacy contact will be able to:

Write a post at the top of the timeline for the profile.

Respond to new friend requests from family members and friends who had not yet connected on Facebook.

Update the profile pictures and cover photo.

Users may also opt to let their legacy contacts download photos, posts and profile information.

The legacy contact will not be able to log in as the deceased user, or see that person's private messages.

While the feature is being rolled out in the U.S. first, Facebook indicated that will expand to more countries. Once it is made available, there will be access to the page in the "security" section in the user's setting.