New York University said Thursday that it will offer free tuition to all its medical school students, in the hope of encouraging more doctors to choose lower-paying specialties.

Many surveys have shown that medical school graduates gravitate to the more lucrative specialties, in part to pay off enormous student debts.

“Every student enrolled in our MD degree program receives a full-tuition scholarship, regardless of merit or financial need, that covers the majority of the cost of attendance,” the school says on its website.

NYU said it got a batch of grants to pay for the full scholarship option, including some from Home Depot co-founder Kenneth Langone, who chairs the medical school’s board of trustees.

“This decision recognizes a moral imperative that must be addressed, as institutions place an increasing debt burden on young people who aspire to become physicians,” Dr. Robert Grossman, dean of NYU’s school of medicine, said in a statement.

Medical school is expensive. The Association of American Medical Colleges calculates that it costs an average of more than $240,000 to attend a public medical school. It costs $322,000 for four years at a private school, the group calculates.

NYU says its scholarship, which begins in the 2018-19 school year, is worth $55,000 a year.

According to the American Academy of Family Physicians, the average debt for medical students is more than $100,000. The medical college association pegs the average debt at nearly twice that, or $180,000.

"I think what this does, it allows good smart kids from every social-economic background to be a doctor and that’s what we need."

To pay it off fast, medical school graduates often choose high-paying specialties such as orthopedics or plastic surgery. A survey last year by Medscape showed that orthopedists make $489,000 a year, compared with family practice physicians and pediatricians, who earn $200,000 a year.

The result is a shortage of the general care practitioners who are most needed, especially in rural parts of the country and in the so-called Rust Belt across the Midwest, according to several studies.

Dr. Janis Orlowski, chief health care officer at the AAMC, called NYU's decision "wonderful".

"There are a number of students who choose not to go into medical school because they see an overwhelming debt," Orlowski said in an interview.

Orlowski said she struggled to pay off her own medical school debt. "Going into my third and fourth years, my tuition doubled," she said. She took out a bank loan to pay it, but had to argue hard to get the money in the first place.

"I think what this does, it allows good, smart kids from every social-economic background to be a doctor and that’s what we need," she said.

Other high-profile schools have sought in recent years to make their pricey programs more accessible. Stanford University offers full-tuition scholarships to all undergraduates whose family income is under $125,000 a year, and adds free room and board to students whose families earn less than $65,000.

The Massachusetts Institute of Technology offers free tuition to students whose families make less than $80,000 a year, and MIT says 90 percent of its students receive financial aid.