Margaret M. Heckler, a moderate Republican who championed women’s rights in Congress before being appointed — and then forced out — as secretary of Health and Human Services in the Reagan administration, died on Monday at a hospital in Virginia. She was 87 and lived in Arlington, Virginia.

The cause was a heart attack, according to her daughter-in-law Kimberly Heckler.

Heckler represented Massachusetts in the House for 16 years. She supported the Equal Rights Amendment and was the lead House sponsor of the 1974 Equal Credit Opportunity Act, which barred banks and other lenders from discriminating against women based on their gender or marital status.

Her tenure at the Department of Health and Human Services was much briefer. She served about 31 months before being forced out by Donald T. Regan, the White House chief of staff, who insisted that she had been a poor manager of the department. Other conservatives in Washington complained that she had lacked ideological commitment to President Ronald Reagan’s programs.

She resisted leaving, but ultimately accepted the job of ambassador to Ireland.

Heckler won her House seat in 1966 with an upset victory over Joseph W. Martin Jr., a former Republican speaker of the House who was 81. Martin had won his seat in 1924 by criticizing the 83-year-old incumbent at the time as feeble, and Heckler effectively used that piece of history against him.

In the House she had a reputation for waiting to see how others voted, especially her fellow Massachusetts Republican, Silvio O. Conte. The Almanac of American Politics called her indecisive, saying that she “often waits till end of a roll call to vote.”

Those votes earned her a 59 percent career rating from the liberal group Americans for Democratic Action, but only a 28 percent rating from the American Conservative Union.

Though she had supported George H.W. Bush for the 1980 presidential nomination and later fought unsuccessfully to persuade Reagan, the nominee, to keep support for the Equal Rights Amendment in the party platform, she backed Reagan in the general election against President Jimmy Carter and in a series of key House roll calls in 1981.

Those votes, and her firm opposition to abortion, cost her re-election in 1982. As a result of redistricting, she was thrown into a new district with a freshman Democrat, Barney Frank. Though two-thirds of the voters came from her old district and only one-third from his, he won with 60 percent of the vote. Women’s groups turned on her over abortion, and Frank used those pro-Reagan votes on taxes and spending against her.

Looking toward the 1984 election after big Republican losses in 1982, the Reagan administration was concerned in 1983 that polls showed women taking a dimmer view of the president than men did. It sought to put women in high-visibility posts to smooth over those differences, and chose Heckler to head the Department of Health and Human Services.

She acknowledged in an interview in 2011 that she had gotten the post even though she had shown no outward qualifications for it.

“I had never been in charge of a bureaucracy,” she said. “I had never known anything about medicine.”

Her approach, she said, was to be a “catalyst for caring.”

The AIDS epidemic tested that goal, as she coped with the White House’s insistence on holding down spending. Learning of the disease only when she took office in March 1983, she designated it the “No. 1 priority” for her department.

But she warned in June of that year against “unwarranted panic” and “irrational fears.” She told the U.S. Conference of Mayors that “for the overwhelming majority of Americans, there appears to be little or no risk of falling victim to this disease.”

Ten months later, in a news conference, she announced the discovery, by a team headed by Dr. Robert Gallo, of the virus that causes AIDS. The presentation played down comparable work by French researchers.

Heckler predicted that an effective blood test would be “widely available within six months,” and that an AIDS vaccine would be “ready for testing within six months.” Her optimistic manner conveyed the impression that she thought AIDS would be easily conquered, although one of her predictions was not far off. A blood test was licensed 11 months later, and a vaccine was tested, unsuccessfully, late in 1986 in Congo.

But her tenure came to an abrupt end in October 1985, when Regan ousted her.

Heckler blamed a “vendetta” by another White House aide for her removal, and when the administration offered her the ambassadorship to Ireland instead, calling it a promotion, she initially scoffed at the idea, saying the job was “a lovely position for someone else, even though my maiden name is O’Shaughnessy.”

But facing dismissal at the Department of Health and Human Services, she took the post.

Reagan himself appeared with Heckler to announce the appointment in a news conference, a session at which she appeared ill at ease.

“I am delighted, happier than I have been for a long time, that Margaret Heckler has agreed to my request that she become the ambassador to Ireland,” Reagan said. “She has done a fine job at HHS.”

Mary Margaret O’Shaughnessy, a daughter of Irish immigrants, was born on June 21, 1931, in New York City. She graduated from Albertus Magnus College in New Haven, Connecticut, in 1953. Afterward, she married John M. Heckler, who had managed her campaign for the student legislature. Heckler attended Boston College Law School, where she was the only woman in the class of 1956, graduating sixth in her class. She served on the Massachusetts Governor’s Council, a weak advisory body, before running against Martin.

The Hecklers’ marriage of 31 years ended publicly and bitterly in 1984 after John Heckler, the founder of a Boston stock brokerage, filed for divorce. He remarried three weeks later.

Margaret Heckler is survived by their three children, John Jr., Alison Heckler Haensler and Belinda Mulliken; and four grandchildren.

When Heckler took the Dublin post in 1986, the Irish press accused the White House of using the embassy as a “dumping ground” for an ousted Cabinet official. Nor did it help that the Reagan administration had ignored diplomatic procedure by announcing her appointment before clearing it with Ireland.

In anticipation of her ambassadorship, The New York Times called her “shrewd and combative” in a profile. And once she got to Ireland, she became a popular figure because of her efforts to promote American investment there.

As she was departing in 1989, those efforts were recognized by Ireland’s Industrial Development Authority with a silver plaque honoring “her vigorous and dynamic support'’ in promoting industry in Ireland.

Always a deeply religious Roman Catholic, Heckler said that on her return from Ireland, “I became very devoted to affirming the faith for all people.” She worked with Catholic charities, especially medical and anti-abortion institutions.

Protecting the “rights of the unborn is an absolute human right,” she said. “The creation of life is a sacred gift from God, and it has to be preserved.”

This article originally appeared in The New York Times.

Adam Clymer © 2018 The New York Times