A photo posted by on

Singer Selena Gomez revealed today (Sept. 14) that she recently had a kidney transplant due to complications from lupus. But how does lupus affect the kidneys, and why do people with the condition sometimes need kidney transplants?

In an Instagram post, Gomez, who is 25, explained to fans why she appeared to be "laying low" over the summer. "I found out I needed to get a kidney transplant due to my Lupus and was recovering," Gomez said. "It was what I needed to do for my overall health." The post included a photo of her in the hospital with friend Francia Raisa, who donated the kidney to Gomez.

Lupus is an autoimmune disorder, which means the body's immune system attacks its own tissues, according to the Mayo Clinic. This leads to inflammation that can cause damage in many parts of the body, including the joints, skin, kidneys, heart and lungs. [10 Celebrities with Chronic Illnesses]

Damage to the kidneys is one of the most common health problems for people with lupus, according to the National Institutes of Health (NIH). About half of adults and 80 percent of children with lupus have kidney disease, the NIH said.

In the kidneys, lupus can cause swelling and scarring of the small blood vessels called glomeruli that filter waste products from the blood, according to the National Kidney Foundation.

People with lupus who have inflammation in their kidneys are treated with medicines to suppress their immune systems, according to the NIH. These medicines often work well to control the inflammation, but up to 30 percent of people with lupus who also have related kidney inflammation will develop kidney failure, the NIH said. (Kidney failure means that the kidneys stop working properly and can no longer meet the body's needs.)

Most patients with lupus-related kidney failure are good candidates for kidney transplant, according to a 2005 review paper. People who undergo kidney transplants need to take drugs for the rest of their lives to stop their bodies from rejecting the new organ, but these drugs are similar to the medications already used to treat lupus, according to the National Kidney Foundation.

Gomez was diagnosed with lupus in 2013, and she first revealed her diagnosis to the public in 2015.

In her post today, Gomez had a special note of thanks to her friend for donating the kidney.

"There aren't words to describe how I can possibly thank my beautiful friend Francia Raisa. She gave me the ultimate gift and sacrifice by donating her kidney to me," Gomez said.

Original article on Live Science.