Democrats clinched two more years of controlling the House but with a potentially razor-thin majority, a bittersweet finale to last week’s elections that has left them divided and with scant margin for error for advancing their agenda, Associated Press reported.

The party on Tuesday nailed down at least 218 seats, according to The Associated Press, and could win a few others when more votes are counted.

Democrats secured the majority after The Associated Press declared three winners late Tuesday: incumbents Kim Schrier in Washington, Tom O’Halleran in Arizona and Jimmy Gomez in California.

By retaining the House, Democrats will control the chamber for four consecutive years for only the second time since 1995, when Republicans ended 40 years of Democratic dominance.