Josh Hardy, in the summer of 2013, when family members said he was at his healthiest. (Family Photo)

Just hours after social-media supporters of a dying 7-year-old boy pressured a reluctant biotech company into giving him an experimental medication, the backlash began.

Is “it rite to save 1 child an[d] not the rest?” wondered one commenter on a news forum. “It’s really not fair to the thousands of others that were turned down just because they didn’t make a big public outcry,” said another.

The Herald-Sun newspaper in Durham, N.C., where the company that makes the drug is based, said it was glad for the boy’s sake that he was able to get the medicine. “But the process leaves us pained,” the editorial board wrote. “This is no way to make health-care decisions.”

The story of how Joshua Hardy — a first-grader from Fredericksburg, Va., who is fighting off an infection after getting a bone-marrow transplant — got access to an unapproved treatment when others with similar requests were turned down highlights the ethical conundrums facing doctors, companies and regulators in the era of Facebook and Twitter.

In the days leading up to the drug company’s change of heart March 11, contrasting photos of Josh — smiling in baseball outfits and then lying in his hospital bed with tubes sticking out of his body — were all over the Internet. He has beaten cancer four times since he was 9 months old. But the disease has left his body without much of an immune system, and in February he was infected with a virus that left him close to death.

Nearly 20,000 people signed a petition supporting “compassionate use” for Josh, which allows a drug to be administered outside of a clinical trial. Hundreds bombarded Chimerix, a small, publicly traded company that makes the drug, with e-mails and calls on the boy’s behalf. Even Washington Redskins quarterback Robert Griffin III took sides, tweeting to his 1.12 million-plus followers to “#savejosh.”

Critics of the strategy say they sympathize with Josh’s parents and admire them for being willing to do anything to save their child, but they decry the crowdsourcing of medical decisions and warn that the case may set a dangerous precedent.

“You couldn’t get a more troub­ling and impossible-to-resolve moral dilemma than this one,” said Arthur Caplan, director of the division of medical ethics at New York University’s Langone Medical Center.

From the perspective of the public and future patients, it’s best for the company to focus on getting the drug approved as soon as possible so that the largest number of people can be helped, Caplan said. But from a patient’s point of view, getting immediate access to the drug is what’s important.

“It’s a trade-off between the public good versus self-interest,” Caplan said. “They conflict. There is no way of getting around it.”

Richard Plotkin, a 69-year-old retired trial lawyer from New Jersey who started the Max Cure Foundation after his grandson was diagnosed with lymphoma at age 4 and who was at the center of efforts to save Josh, defends the campaign as necessary.

“I knew we had at the latest until the end of the week before the boy would die, and the best way to make a company change its mind — fast — is to get the public involved,” Plotkin said.

The parents of 11-year-old Sarah Murnaghan also have faced intense criticism. The girl received two lung transplants (the first one failed) last June after her parents launched a Change.org petition that got more than 370,000 signatories and sued in an effort to get their daughter an organ more quickly.

Janet Murnaghan said she knows that not everyone agrees with the way her daughter’s case was resolved — a judge ordered the transplant network to put her on the adult list, and she jumped to the top because of the severity of her condition — but she believes it did the public good by demanding that patients and their families have a larger voice in how organs are allocated.

Since the early days of the AIDS epidemic, patients with life-threatening conditions have become increasingly vocal about demanding access to drugs still in development. The Food and Drug Administration in 1987 created new rules, amended in 2009, for expanded access or compassionate use to allow what it says is “broad and equitable access” to those treatments. But the program remains limited. Since 2009, the agency has approved an average of 1,030 applications each year; each request may be for multiple patients.

Most patients’ requests never make it to that stage.

Before the FDA gets involved, companies must agree to allow their drug to be used. But many companies are reluctant to do so for a host of reasons — legal, financial and logistical — and, in most cases, they hold firm despite intense public pressure.

Andrea Sloan, 45, a lawyer whose case drew the support of several Texas legislators as well as Newt Gingrich, died Jan. 1 while fighting for access to a drug to treat ovarian cancer made by BioMarin Pharmaceutical. Nick Auden, a Denver father of three with melanoma who was able to gather 500,000 signatures for a petition for compassionate use of a Merck drug, died in November without getting the treatment. He was 41.

The companies argue that if something goes wrong with a patient who gets a drug outside the clinical-trial process, it could slow down their larger development program while the FDA investigates. Moreover, insurance companies typically won’t pay for unapproved treatments, so either the drug companies have to bear the costs or give the treatment only to those who can afford it. The companies also often create only a small supply of a drug for clinical trials; making more or diverting it could be time-

consuming and costly.

Even if those challenges can be overcome, companies say, there are ethical issues.

Kenneth Moch, chief executive of Chimerix, which makes the drug that the Hardys were seeking, said that until 2012 the company had a large compassionate-use program but had to discontinue it to focus its limited resources — it has only 60 employees and is not profitable — on getting the drug approved.

During the past two years, Chimerix has nonetheless received 200 applications for compassionate use, and 80 were for adenovirus infections like the one Josh has. All of the requests were turned down. “Every one of those is heart-wrenching. But making it available for one child, whatever the reason, as an exception is not equitable distribution,” he said.

Chimerix turned down the Hardys’ requests, too. But after several days of intense phone calls with officials at the FDA’s Division of Anti-Viral Products — who heard about Josh’s plight through the media — they worked out a solution.

Instead of getting the drug through the compassionate-use program, Josh got it through the clinical-trial process. Although he wasn’t eligible for the trial in progress — it is for adults with a different condition — the FDA offered to immediately green-light a new clinical trial that would be designed for pediatric patients with Josh’s condition.

In this way, medical experts say, the FDA created a wall that would allow Chimerix to give Josh and up to 19 other children the drug for free without opening the floodgates to others.

The deal was also a big win for Chimerix: No only did it solve its public relations crisis, it allowed the company to cut through the red tape that is typically required to get another clinical trial approved. The company’s stock has soared nearly 29 percent since the news was announced Tuesday.

“There is no doubt that the social media campaign by the Hardys helped accelerate the dialogue,” Moch said.

Josh, who on Wednesday received his second dose of the treatment — an antiviral drug called brincidofovir — remains in intensive care at St. Jude Children’s Research Hospital in Memphis.

His mother, Aimee Hardy, wrote hopefully on Facebook that the virus in Josh’s blood is replicating more slowly, and he is in less pain than before. “Glory to God,” she said, “the medicine is working.”