DUBLIN — Fighting off last-ditch resistance, Irish lawmakers overwhelmingly passed a bill introducing free and legal abortion to a nation that was long a bastion of staunchly conservative Catholicism, seven months after voters repealed a constitutional ban on abortion.

An often heated session of the Parliament’s lower house on Wednesday had to be extended several times, as a small number of members — mainly independent conservatives — talked at length on dozens of amendments, almost all of which were voted down by large majorities. The bill’s opponents attempted to prolong the debate even further, which could have derailed the government’s plan to make abortion available in January.

Ultimately, the house approved the bill just before midnight Wednesday by a vote of 90 to 15, with 12 abstentions, and it moved on Thursday to the upper house. Ivana Bacik, a Labour Party lawmaker in the upper house, said she thought it very likely that the bill would pass and become law before the holiday recess the week after next.

The bill would allow a woman to seek abortion for any reason up to the 12th week of pregnancy, and later in a case of fatal fetal abnormality or serious risk to a woman’s life or health. It includes a mandatory three-day waiting period after first consulting a doctor.