The Food and Drug Administration on Friday cautioned against prescribing hydroxychloroquine to COVID-19 patients outside of hospital settings or clinical trials. The drug, an antimalarial, was repeatedly touted by President Donald Trump as a possible treatment for the coronavirus.

"The FDA is aware of reports of serious heart rhythm problems in patients with COVID-19 treated with hydroxychloroquine or chloroquine, often in combination with azithromycin," the FDA wrote on its website.

Full coverage of the coronavirus outbreak

"We are also aware of increased use of these medicines through outpatient prescriptions. Therefore, we would like to remind health care professionals and patients of the known risks associated with both hydroxychloroquine and chloroquine," the FDA said.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The agency said hydroxychloroquine can still be used in hospital settings or in clinical trials, but it was not immediately clear whether some planned trials would be stopped.

Cardiologists have been sounding the alarm about hydroxychloroquine's heart risks for weeks, saying the drug could be deadly in a small number of patients who are susceptible to heart conditions.

Hydroxychloroquine, and a related compound called chloroquine, is a medication that's been around for decades. It's used to treat malaria, as well as certain autoimmune diseases, including lupus and rheumatoid arthritis.

Enthusiasm for its potential as a treatment for the coronavirus began to build in March, when a French study suggested hydroxychloroquine plus azithromycin (the antibiotic known as a Z-Pak) might benefit COVID-19 patients. The journal that published the French study, however, later said that the article did not meet its expected standard.

A week later, the FDA issued an emergency use authorization for hydroxychloroquine, allowing health care providers to use the medicine for COVID-19 in hospitalized patients with severe disease, even though the drug had not been approved as a specific treatment for the illness, and was known to increase the risk for irregular heartbeat.

Download the NBC News app for full coverage of the coronavirus outbreak

But the previous fervor for hydroxychloroquine has diminished. In one case, a New York woman with coronavirus symptoms died after her family said a doctor prescribed her a combination of hydroxychloroquine and azithromycin without confirming she had COVID-19 or testing her for heart problems ahead of time. The exact cause of death for the woman has not yet been determined.

The Centers for Disease Control and Prevention has also pulled back on its guidance for using hydroxychloroquine for COVID-19 and no longer offers recommendations for dosage. And earlier this week, a National Institutes of Health panel of experts said doctors should not use hydroxychloroquine and azithromycin to treat the illness, citing lack of evidence.

Follow NBC HEALTH on Twitter & Facebook.