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.