The Homecoming Court candidates stood expectantly on the wooden gym floor at Walt Whitman High School in Bethesda on Friday, waiting to hear who would be crowned. All but one.

Alexis Hanford sat in her wheelchair, her left leg ramrod straight in a brace swaddled in pink-and-black leopard-print padding, her long, red hair newly cut and her toes freshly painted with beige polish.

When the names of the contestants were announced and when Alexis was declared the Homecoming Princess, a student gently placed a crown of pink feathers and rhinestones atop her head.

From atop the bleachers, Lynn Knieriem watched her daughter, eyes shimmering.

Just six weeks before, the 16-year-old lay in a hospital bed at Children’s National Medical Center, sweating with a fever of 104 degrees as she battled a rare and especially vicious strain of necrotizing fasciitis — known as flesh-eating disease. To save her left leg and her life, the Whitman junior underwent 17 operations to cut away dead skin and muscle and to try to eradicate the bacteria.

Alexis’s unusually optimistic world view and her sense of humor helped.

“She’s such a fighter,” said Laurel C. Blakemore, chief of orthopedics and sports medicine at Children’s, who took part in most of her operations. “Her attitude and the fact that she didn’t give up really made the difference.”

On July 25 near Ukiah, Calif., Alexis and her family were enjoying a family reunion in a remote area about 10 miles from a main road. Alexis dropped from a tree swing into a freshwater lake, and a piece of tree bark gashed her left leg.

At a hospital, doctors pulled wood from the wound, cleaned the area and stitched her up. Five days later, she was back in Bethesda, and the wound was still sore. Her best friend, Lily Blum, was visiting, and the two had just ordered cheese pizza when fluid and blood began to squirt from Alexis’s wound. The skin around it turned colors and swelled.

“My leg burst. . . . My pain level went from a 3 out of 10 to 10 out of 10 in a second and started rising from there,” Alexis said.

She was taken by ambulance to Sibley Memorial Hospital but she then went to Children’s, where an emergency room doctor realized that she was suffering from “compartment syndrome,” a potentially fatal condition in which pressure can build up so much in the affected part of the body that it blocks the flow of blood.

Within an hour, orthopedic surgeons were slicing open her leg to relieve the pressure. That’s when the full extent of the infection and muscle loss was detected, doctors said. But exactly which germs were causing the infection was yet to be determined.

Roberta L. DeBiasi, acting chief of the pediatric infectious diseases division at Children’s, said that doctors asked questions about her accident to find clues. Learning that Alexis had jumped into freshwater helped microbiologists isolate the offending bacteria.

It wasn’t the Streptococcus that is the more common cause of flesh-eating disease, but rather an antibiotic-resistant strain of bacteria that includes aeromonas, or water-related microbes.

Just a few months earlier, a young Georgia woman made news when a flesh-eating infection — contracted when a zip line cut her calf — forced doctors to amputate her hands and feet. Alexis’s mother knew a little about the case but forced herself not to read any more about it.

“I didn’t want to make any parallels,” Alexis’s mother said.

“Until this happened,” she said, “I thought we had lived a charmed life. If something bad happened, I always could think, ‘But I don’t have a sick child.’ ”

Doctors put Alexis on an intravenous drip with the broadest spectrum of antibiotics, and she was wheeled into the operating room every few days so doctors could cut away dead muscle and tissue.

In a novel intervention, small beads of cement that had been immersed in antibiotics were delivered directly to the wound and replaced during each surgery, DeBiasi said.

Eventually, the infection was eradicated, and Alexis went to MedStar National Rehabilitation Hospital for a few weeks to start the very long process back to full recovery.

That’s where she turned 16, and her mother organized a party complete with Italian food and 40 of Alexis’s closest friends and relatives, including her 14-year-old sister, Haley.

“It wasn’t the sweet 16 I had been planning, but it was probably the best party I ever had,” Alexis said.

Once a seasoned athlete who played soccer competitively, Alexis knows she has to learn again how to walk and will always have to use a small brace, although people who don’t know she has it won’t be able to tell, she said. One day, she hopes to run again.

Alexis doesn’t remember the first several weeks of the worst part of her ordeal, but she says the experience has changed her.

“Even though it can be frustrating to have to deal with this, there are always people who are worse off,” she said. “I saw them in the hospital and in rehab. What we consider normal — going to college, getting a job, getting married — isn’t going to happen for those people. . . . It just makes you look at life differently.”

Alexis is now being tutored at home, and she knows she likely won’t graduate with her friends.

Lily, a 16-year-old junior, decided that she wanted to thank the doctors who saved her best friend, so she launched the “Alexis Healing Project,” a nonprofit effort to raise funds for Children’s Hospital.

The project, in partnership with Charm Georgetown, designed a “healing bracelet” made from wood and stone as a testament to Alexis’s determination and her friends’ commitment to helping her recover.

Lily and Haley and Alexis’s other close friends were with her every step of the way on Friday, when she returned to school, her first big outing. Before the pep rally started, Whitman Principal Alan Goodwin escorted her in her wheelchair to the gym and ordered her friends “to protect her leg” when friends rushed over to see her.

When she was crowned over two other girls as princess, not a word was uttered about her ordeal. Alexis was just fine with that.

“I love this school,” she said. “I am just so happy to be here.”