WASHINGTON (AP) — White House-backed immigration legislation is gaining momentum in the Senate, where key lawmakers say they are closing in on a bipartisan compromise to spend tens of billions of dollars stiffening the bill's border security requirements without delaying legalization for millions living in the country unlawfully.

Under the emerging compromise, the government would grant legal status to some of those immigrants while the additional security was being installed. Green cards would be withheld until the security steps were complete.

Officials described a so-called border surge that envisions doubling the size of the Border Patrol with 20,000 new agents, construction of hundreds of miles of additional fencing along the Mexican border and the purchase of new surveillance drones. The 10-year cost of the additional agents alone was put at $30 billion.