Updated

The Latest on Congress' border security measure and President Donald Trump (all times local):

8:55 p.m.

Hard-fought legislation that gives President Donald Trump 55 additional miles of fencing along the U.S.-Mexico border — well short of what he requested — is on the way to his desk after a bipartisan House vote.

The bill also closes a chapter by preventing a second government shutdown at midnight Friday and by providing $333 billion to finance several Cabinet agencies through September.

Trump has indicated he'll sign the measure though he is not happy with it, and for a few hours Thursday he was reportedly having second thoughts.

The White House has announced Trump will declare a national emergency that would enable him to transfer funding from other accounts for additional miles of border fencing.

__

6 p.m.

Some Democratic state attorneys general say they may go to court to block any declaration of a national emergency on the southern border by President Donald Trump.

Attorney General Xavier Becerra of California wrote Thursday on Twitter that any border crisis is of the president's own making and "we will do what we must to hold him accountable."

His counterpart in Washington state, Bob Ferguson, said that if Trump's declaration depletes federal aid to the state, he'll "take appropriate steps to block this unlawful action."

On Twitter, Puerto Rico Gov. Ricardo Rossello told the president "we'll see you in court" if he goes through with the declaration.

Trump is prepared to invoke a national emergency to build the U.S.-Mexico wall after Congress refused to provide $5.7 billion he was demanding as part of a budget compromise to avoid a federal shutdown.

__

5:30 p.m.

The Democratic Party's field of presidential hopefuls is split on a $333 billion government funding bill that includes nearly $1.4 billion in money for barriers along the U.S.-Mexico border.

The funding bill won support from Sen. Amy Klobuchar of Minnesota, who launched her presidential campaign Sunday, and from Vermont Independent Sen. Bernie Sanders, who is expected to join the Democratic primary soon. Ohio Sen. Sherrod Brown, another Democrat weighing a presidential run, also voted in favor.

White House hopefuls who opposed the legislation include California Sen. Kamala Harris, New Jersey Sen. Cory Booker, Massachusetts Sen. Elizabeth Warren and New York Sen. Kirsten Gillibrand.

Sanders says he has "concerns" about the bill but "I cannot turn my back on" federal workers who would have to work unpaid in a government shutdown.

___

This item has been corrected to show that the government funding bill is $333 billion, not $333.

___

5 p.m.

The top two Democrats in Congress say President Donald Trump's upcoming move to declare a national emergency to fund his U.S.-Mexico border wall would be "a lawless act" and "a gross abuse of the power of the presidency."

House Speaker Nancy Pelosi and Senate Minority Leader Chuck Schumer say in a joint statement that "Congress will defend our constitutional authorities."

Pelosi has the ability to pass legislation to overturn any such move by Trump, and that measure could pass the GOP-held Senate as well, though Trump could veto it. Trump's move would also face a certain court challenge.

Pelosi and Schumer say, "This is not an emergency, and the president's fearmongering doesn't make it one."

___

4:45 p.m.

Congressional aides say there is $21 billion in military construction funds that could potentially be used by President Donald Trump to build a wall on the southern border, if he declares an emergency.

The aides say the president has the authority to take the funds, but according to the law they have to be used in support of U.S. armed forces.

There is about $10 billion in funds from the current 2019 fiscal year that ends Sept. 30, and another $11 billion from the previous four years that haven't been obligated or contracted for a project, the aides say. They spoke on condition of anonymity because they weren't authorized to speak publicly about the funding details.

The Defense Department has declined to provide any details on the amount of money available.

— Lolita C. Baldor

___

4:22 p.m.

The Senate has passed a bipartisan border security plan that would finance 55 additional miles of fencing along the U.S.-Mexico border, significantly less than President Donald Trump wanted.

The vote came shortly after the White House announced he'll sign the measure — and immediately announce he'll use emergency powers to build additional miles without approval from Congress.

The 83-16 Senate vote advances the measure to the House for a vote Thursday night that would send it to Trump for his signature in time to avert another partial government shutdown this weekend.

Senate Majority Leader Mitch McConnell, who has previously said he opposes the use of emergency powers, said he will support Trump's decision to use them.

The border security plan is part of a broader $333 billion spending bill.

___

4 p.m.

House Speaker Nancy Pelosi says if President Donald Trump declares a national emergency at the border he's making an "end run around Congress."

Pelosi says there's no crisis at the border with Mexico that requires a national emergency order.

She is not saying if House Democrats would legally challenge the president. But Pelosi says if Trump invokes an emergency declaration it should be met with "great unease and dismay" as an overreach of executive authority.

Trump is prepared to invoke a national emergency to build the U.S.-Mexico wall after Congress refused to provide $5.7 billion he was demanding as part of a budget compromise to avoid a federal shutdown.

Trump indicated he would sign the bill to keep the government running past Friday's deadline but also declare the emergency.

___

3:40 p.m.

The White House confirms that President Donald Trump will sign a bill averting a potential partial government shutdown at the end of the week.

Press Secretary Sarah Sanders says Trump will also take "other executive action — including a national emergency" as he seeks to keep his border wall pledge. The bipartisan congressional legislation expected to pass Thursday includes only a fraction of the billions of dollars Trump is seeking to build a wall along the U.S.-Mexico border.

Sanders says, "The President is once again delivering on his promise to build the wall, protect the border, and secure our great country."

An emergency declaration to shift funding from other federal priorities to the border is expected to face swift legal challenge.

___

3:15 p.m.

Senate Majority Leader Mitch McConnell says President Donald Trump has indicated he's prepared to sign the government funding bill and issue a national emergency on the border.

McConnell said Thursday the Senate will soon vote on the bill that's needed to avoid a partial federal shutdown Friday.

The comprise measure keeps departments running through the fiscal year but without the $5.7 billion Trump wanted for the border wall with Mexico.

The House is also expected to vote on the bill later Thursday.

Trump's assent would end a raucous legislative saga that commenced before Christmas and saw Trump force a record 35-day partial federal shutdown.

___

12:30 p.m.

President Donald Trump says he is reviewing the border security compromise. But he is not yet promising to sign off on the deal.

Trump tweeted Thursday: "Reviewing the funding bill with my team at the @WhiteHouse!"

The president is widely expected to sign the compromise that would avert a government shutdown, but would only provide a fraction of the dollars he sought for a barrier along the U.S.-Mexico border. Still, Trump has not publicly declared his plans and has made clear he is not happy with the deal.

The Democratic-controlled House was poised to pass the sweeping measure Thursday evening, and the Republican-led Senate was expected to approve as well. Bargainers formally completed the accord moments before midnight Wednesday night.

___

10:25 a.m.

Republican Sen. Chuck Grassley says he's praying that President Donald Trump will sign the border security deal into law to prevent a government shutdown.

Grassley was presiding over the Senate opening on Thursday when after the morning prayer, he added: "Let's all pray that the president will have wisdom to sign the bill so the government doesn't shut down."

Congress is expected to vote Thursday on the bipartisan accord to prevent another partial federal shutdown ahead of Friday's deadline.

The package funds several departments but does not provide $5.7 billion Trump was demanding for the wall with Mexico. Instead, it allows nearly $1.4 billion for border fences and barriers.

Senate Majority Leader Mitch McConnell urged senators to approve it as "a compromise that no side will view as a perfect deal."

___

1:40 a.m.

Congress is set to resolve its border security brawl with President Donald Trump in uncommonly bipartisan fashion.

Lawmakers are preparing to pass a compromise providing just a sliver of the billions Trump has demanded for a wall with Mexico. It would also avert a rekindled government shutdown this weekend and finance dozens of federal agencies for the rest of the fiscal year.

Congressional leaders plan Thursday votes on the package. Passage is expected first in the Republican-led Senate, then the Democratic-controlled House.

Trump's signature is expected, though it's hardly guaranteed.

Trump's assent would end a raucous legislative saga that commenced before Christmas and saw Trump force a record 35-day partial federal shutdown.

The bipartisan deal contrasts with the parties' long-running clashes over health care, taxes and investigations of the president.