The House on Tuesday passed "right to try" legislation that would allow people with life-threatening illnesses to bypass the Food and Drug Administration to obtain experimental medications, ending a drawn-out battle over access to unapproved therapies.

President Donald Trump is expected to quickly sign the measure, which was praised by supporters as a lifeline for desperate patients but denounced by scores of medical and consumer groups as unnecessary and dangerous.

The Senate passed the bill in August, and the House approved its own version in March. That version was less objectionable to the medical groups, but then the legislation got bogged down. With the White House demanding action, House leaders in recent days decided to short-circuit the process by taking up the Senate-passed bill. The vote was 250 to 169.

The measure, championed by Sen. Ron Johnson, R-Wis., is designed to give patients an alternative way to obtain drugs not approved by the FDA. Currently, there are two options for patients seeking experimental medications: enrolling in clinical trials if they are eligible or participating in the FDA's "expanded access" program. The agency has said that it approves almost all such requests to that program.

The FDA would be largely left out of the equation under the new legislation and would not oversee the right-to-try process. Drug manufacturers would have to report "adverse events" — safety problems, including premature deaths — only once a year. The agency also would be restricted in how it used such information when considering the experimental treatments for approval.

Patients would be eligible for right-to-try if they had a "life-threatening illness" and had exhausted all available treatment options. The medication itself must have completed early-stage safety testing, called Phase 1 trials, and be in active development with the goal of FDA approval.

The right-to-try legislation has been championed by the libertarian Goldwater Institute, a Phoenix-based think tank that has worked to pass similar laws in 40 states. Vice President Mike Pence, who signed state right-to-try legislation while governor of Indiana, has pushed hard for a federal law, meeting frequently with families whose children suffer from rare or devastating diseases.

Trump has mentioned the legislation several times, including in his State of the Union address and recently during a White House appearance about drug prices. On Monday, the White House issued a statement saying the administration "believes that treatment decisions for those facing terminal illnesses are best made by the patients with the support and guidance of their treating physicians."

The issue has been more challenging for FDA Commissioner Scott Gottlieb. Four former FDA commissioners have criticized right-to-try legislation, and Gottlieb himself expressed reservations about the Johnson bill last fall, saying it could undermine the agency's authority.

But Tuesday, Gottlieb tweeted about the legislation, "I stand ready to implement it in a way that achieves Congress' intent to promote access and protect patients; and build on FDA's long-standing commitment to these important goals."

During the House floor debate, Rep. Frank Pallone Jr. of New Jersey, the ranking Democrat on the House Energy and Commerce Committee, warned that eliminating FDA oversight would "provide fly-by-night physicians and clinics the opportunity to peddle false hope and ineffective drugs to desperate patients." He said he was especially concerned that patients who have life-threatening illnesses such as heart failure and diabetes would be eligible for right-to-try, even if they were not close to death.

If the bill is so good for patients, he asked, "why does every major patient group overwhelmingly oppose it?" He was referring to a letter sent by more than 100 patient advocacy and consumer groups — including the American Cancer Society Cancer Action Network, Friends of Cancer Research and the National Organization for Rare Disorders — opposing the bill.

Michael Becker, a former biotech executive who has advanced head and neck cancer, said that "the gullible will applaud" the passage of the measure but that he is worried about those who may be "targeted by unscrupulous snake oil salespeople seeking profits."

"It's a sad day for patients if this legislation becomes law," said Ellen Sigal, chair of the Friends of Cancer Research.

Critics also note that drug companies, not the FDA, are the main obstacle to seriously ill patients getting unapproved drugs outside clinical trials. Manufacturers sometimes don't have large enough supplies to provide drugs outside trials or don't want to risk a safety problem involving a drug that has not yet passed FDA muster.

There is nothing in the Johnson bill that would compel pharmaceutical firms to provide the treatments, something critics say shows that it will have little effect.

Supporters of the bill say charges that the legislation will be harmful or ineffective are "scare tactics." After the House vote, Victor Riches, president and chief executive of the Goldwater Institute, said in a statement that "millions of Americans who have been told they are out of options and it's time to get their affairs in order, are closer to having the opportunity for one last treatment, without having to get permission from the federal government first."

Patients with serious illnesses took to social media Tuesday to urge lawmakers to pass the bill.

Last week, the governors of eight states and Guam also asked Congress to pass a federal right-to-try law to ensure that the FDA and other federal agencies do not interfere with the implementation of state laws. In April, Americans for Prosperity, which is backed by the Koch brothers, launched a national advertising campaign calling on Congress to pass the bill.