Daniel was as full of energy as any 10-year-old boy, competing on a travel soccer team and once running a 5K race in 25 minutes with no training.

Until the swelling started.

First, it happened in his genitals, leading doctors to suspect poison ivy or some other type of skin inflammation. Then he started to feel short of breath, to the point he could no longer catch his slowest peers in a neighborhood game of tag. Stumped, a doctor tried listening to Daniel’s heartbeat — yet alarmingly, was unable to hear it. A chest X-ray soon revealed the reason: The Virginia boy’s heart was surrounded by three liters of milky-white fluid. It was leaking from his lymphatic ducts for some unknown reason, and it would soon turn up throughout his body: lungs, kidneys, liver, and legs.

In a study published this week, physicians at Children’s Hospital of Philadelphia described nearly two years of medical sleuthing that finally cracked the case. On the verge of counseling the boy’s parents that he might not survive, the team discovered that the underlying cause was a rare — and, it turned out, treatable — genetic mutation.

“We had never seen this before,” said cardiologist Yoav Dori, one of the authors of the study in Nature Medicine.

Because that mutation also can cause certain cancers in adults, the physicians sought approval to treat the boy with a cancer drug, after first testing it in zebrafish.

The treatment appears to have worked. The boy’s lymphatic ducts have stopped branching in abnormal directions, its valves began to flow in the right direction, and his swelling steadily subsided, the authors reported. His energy came back to the point he could return to school.

Others not involved with the study said it illustrated the growing potential of precision medicine: tailoring a treatment to an individual patient as guided by the results of a genetic test.

“These are wonderful developments for patients,” said Denise Adams, codirector of the Vascular Anomalies Center at Boston Children’s Hospital.

The lymphatic system falls in between cardiology, immunology, and other traditional specialties of medicine, and historically has received relatively little attention from the health-care industry. Yet the network of ducts connected to the veins plays a variety of crucial roles, removing impurities from the body and also transporting infection-fighting cells.

When the system leaks or flows the wrong way, swelling develops, such as in children who have undergone certain kinds of open-heart surgery. In such cases, Dori and colleagues at CHOP’s Center for Lymphatic Disorders have successfully used catheters to patch the leaks, typically inserting small metal coils coated with medical-grade glue.

But in Daniel, that approach did not work, recalled his mother, who declined to give the family’s last name to protect her son’s privacy. Each time the physicians tried to patch a leak, a new one would emerge.

“It was like a sprinkler system,” she said. “You block it in one spot, it finds another route.”

Starting in spring 2015, Daniel became a frequent visitor to the Philadelphia hospital, traveling six hours each way from his home in Virginia. Tests revealed that he also had celiac disease, so in addition to the restricted, nonfat diet dictated by his lymphatic issues, he could not eat anything containing gluten.

Physicians then tried connecting some of Daniel’s abnormal lymphatic ducts directly to his veins, which helped in the short term. But he went downhill again, to the point that he was being measured for a wheelchair, Dori said.

A glimmer of hope came from genetic testing, overseen by Dori’s colleague Hakon Hakonarson, director of the hospital’s Center for Applied Genomics. The mutation was known to cause certain lung and skin cancers, but the apparent connection with lymphatic disorders was news.

To learn more, researchers raised zebrafish that were modified to have the same mutation. The fish are commonly used to test genetic mutations in laboratories, as they are easy to raise and their transparent skin allows scientists to see their organs.

Like Daniel, the fish began to swell with abnormal fluid. Yet when the fish were treated with a cancer drug called cobimetinib, which inhibits the activity of the affected gene, the swelling went down. Another drug in the same class, called trametinib, had a similar effect on human lymph cells grown in a laboratory dish.

The case became even stronger when the same mutation was found in another patient with lymphatic-system leakage — an unrelated adult woman who was identified through a patient advocacy group.

Physicians offered Daniel’s parents the option of trying trametinib on their son, and they were willing. Jean Belasco, one of the physicians treating Daniel, obtained special compassionate permission from the U.S. Food and Drug Administration to use the drug for this unapproved indication, and also persuaded the family’s insurer to cover it. Its list price runs well into the thousands of dollars per month, Daniel’s mother said.

Treatment began in March 2017. Months passed, yet Daniel did not seem to get better. Despairing, his family took him on a Caribbean cruise that fall with support from the Make-A-Wish Foundation.

But upon their return, they noticed that swelling in his legs had started to subside. His appetite started to return. At CHOP, MRI scans showed that new, properly formed branches were sprouting in his lymphatic ducts, Dori said.

“We have never seen anything like this, an entire organ system in the body remodeling,” the physician said.

The adult patient with the same mutation, who was being treated at another hospital, died before the treatment became available, so the test of the drug ended up being a study of just one person. Still, Daniel’s physicians say they have no doubt his improvement was due to the treatment. Adams, of Boston’s Children’s, agreed, saying trametinib should now join the small array of treatment options for certain rare lymphatic disorders.

Though Daniel’s genetic mutation can cause cancer in adults, physicians said the boy was not at any higher risk of that disease because his mutation was present at birth. The mutation tends to cause cancer when it develops later in life.

By the time his eighth-grade school year started in fall 2018, Daniel felt well enough to attend full time. His lung capacity remains diminished from scarring that occurred during his long convalescence, but he can ride his bike again and play basketball with friends.

And as he enters high school this fall, his mother said he is happily signed up for a rite of passage that makes many ninth graders roll their eyes: physical-education class.