WASHINGTON (AP) — A bipartisan group of House members announced a deal Thursday on sweeping immigration legislation, a breakthrough that could boost chances for one of President Barack Obama‘s top second-term priorities.

It came after months of secretive talks among the four Republican and four Democratic House members had seemed to stall in recent days even as an immigration bill in the Senate moved forward. The House members met for two hours Thursday evening, emerging to announce they had a deal.

“We have an agreement in principle. We’re now going to work on finishing up the drafting of the bill,” said Rep. John Carter, R-Texas, a leader of the group.

Rep. Luis Gutierrez, D-Ill., another member, said over Twitter: “Important breakthrough, some details still to be worked out, but very pleased things are moving forward.”

Carter and others declined to give details, saying they’d agreed among themselves not to do so.

Group members had been saying for months that they were near a deal, but in recent days talks appeared close to breaking down over a few unresolved details. These included a new visa program for lower-skilled workers, and how to handle health care coverage for immigrants in the country illegally who would gain legal status under the bill. Lawmakers and aides suggested earlier Thursday that one option would be for the group to release a bipartisan bill that simply left those issues out, allowing Republicans and Democrats in the group to offer their own plans on those aspects of the legislation.

Meanwhile, members of the group were under pressure to deliver from other lawmakers and outside advocates who feared they would lose their window to have a voice in the debate if they didn’t produce something soon. A bill released last month by leading senators is moving toward a vote in the Senate Judiciary Committee and has become the focus of the immigration debate.

“I am concerned that the bipartisan group has been unable to wrap up their work,” House Speaker John Boehner, R-Ohio, told reporters earlier Thursday, before the group announced its deal. “And I know that there are some very difficult issues that have come up. But I continue to believe that the House needs to deal with this and the House needs to work its will. How we get there, we’re still dealing with it.”

The House group had struggled to come up with a plan that could have a possibility of passing the Republican-controlled House while also satisfying Democrats in the group. They have discussed a path to citizenship that would take 15 years for the estimated 11 million people living here illegally, two years longer than contemplated by the Senate bill, which is backed by Obama.

Overall, the legislation would share the same goals as the Senate plan: boosting border security, an increased focus on workplace enforcement, new means to allow workers to enter this country legally and the eventual prospect of citizenship for millions.

As the House group bogged down, House Judiciary Committee Chairman Bob Goodlatte, R-Va., separately has moved forward with individual, narrowly focused bills on immigration, including one on workplace enforcement that was discussed at a hearing Thursday.

The Senate Judiciary Committee held its third work session Thursday to plow through some 300 amendments to the Senate immigration legislation. The committee voted down an amendment by Sen. Chuck Grassley, R-Iowa, that would have required the implementation of an electronic employer ID verification system in 18 months, instead of the four years contemplated by the bill.

Republican Sens. Jeff Flake of Arizona and Lindsey Graham of South Carolina – two of the bill’s Republican authors – voted with Democrats against the amendment, which was defeated 13-5. So did Sen. Orrin Hatch, R-Utah, a potential swing vote on the bill.

Thursday’s committee action was low-key, but behind the scenes efforts were under way to reach a deal on a series of amendments by Hatch that would benefit the high-tech community by making it easier for companies to access and use H-1B visas, which go to highly skilled workers. The bill increases the supply of these visas but also adds in protections aimed at ensuring U.S. workers get the first shot at jobs, and tech companies have objected to some of those provisions, which have been championed by Sen. Dick Durbin, D-Ill.

Sen. Chuck Schumer, D-N.Y., a principle author of the bill, was working with Hatch to try to find a compromise but the issue was unlikely to be resolved before next week.

In addition to Carter, Republicans in the House group are Reps. Mario Diaz-Balart of Florida, Sam Johnson of Texas and Raul Labrador of Idaho. On the Democratic side, in addition to Gutierrez, they are Zoe Lofgren and Xavier Becerra of California and John Yarmuth of Kentucky.