Congress is set to resolve its clattering brawl with President Donald Trump in uncommonly bipartisan fashion as lawmakers prepare to pass a border security compromise providing a mere sliver of the billions he's demanded for a wall with Mexico and averting a rekindled government shutdown this weekend.

With Mr Trump's half-hearted signature widely expected but hardly guaranteed, congressional leaders planned votes Thursday on the sweeping package. Passage first by the Republican-led Senate, then the Democratic-controlled House, was virtually certain, with sizable numbers of both parties' members set to vote "yes". Bargainers formally completed the accord moments before midnight Wednesday.

"I'm sure it's going to pass. I don't know of any drama," said House Democrats' chief vote-counter, Representative James Clyburn.

Mr Trump's assent would end a raucous legislative saga that commenced before Christmas and was ending, almost fittingly, on Valentine's Day. The low point was the historically long 35-day partial federal shutdown, which Mr Trump sparked and was in full force when Democrats took control of the House, compelling him to share power for the first time.

Mr Trump yielded 25 January after public opinion turned against him and congressional Republicans. He had won not a nickel of the $5.7 billion he'd demanded for his wall but had caused missed paychecks for legions of federal workers and federal contractors and lost services for countless others. It was a political fiasco for Mr Trump and an early triumph for House Speaker Nancy Pelosi.

President Trump: a year of high drama at home and abroad Show all 36 1 /36 President Trump: a year of high drama at home and abroad President Trump: a year of high drama at home and abroad Reuters photographer Hannah McKay (Britain's Prime Minister Theresa May and U.S. President Donald Trump walk away after holding a joint news conference at Chequers) "This was the third and final time I was photographing Donald Trump during his working visit to the UK. I'd noticed he had a tendency to hold Theresa May by the hand when they used stairs, so I lay on the floor for fifteen minutes waiting for the pair to exit via some steps. As they did, Trump took May by the arm and shouted over his shoulder, "Yes" in response to the question "Mr. President, will you tell Putin to stay out of the U.S elections?" - from a reporter in the press conference." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump confers with White House Communications Director Hope Hicks as Press Secretary Sarah Sanders listens) "I stayed in the room after our reporters had left, and seemingly unnoticed like the cliched 'fly on the wall', I was witness to this unusual moment." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Chris Bergin (A supporter of Trump and Republican senate candidate Mike Braun at an election night party in Indianapolis) "I saw the colour-coordinated woman in the back of the ball room while covering mid-term elections. She stood out to me because she was lit by a single overhead light that created deep shadows." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Shannon Stapleton (Stormy Daniels, puts her shoe back on after passing through a security screening, as she arrives at federal court) "On the morning that I took this picture there was a mad scrum outside the courthouse to get a picture of Stormy Daniels. She didn't enter the regular entrance of a media gauntlet that was set up for her. I placed myself by a window where I saw her passing through the metal detector. Shooting through the window was difficult but I was able to make the frame." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump appears on the South Portico of the White House with the Easter Bunny during the annual White House Easter Egg Roll) "There are many holiday events at the White House, but one of the most light-hearted happens during Easter, when the President shows up at the balcony of the South Portico accompanied by someone in a big Easter bunny costume. I didn't have the best position, but towards the end, the bunny stood behind the President and I was able to take this shot." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (Melania Trump wearing a jacket with the phrase "I Really Don't Care. Do U?" on the back after a visit to the US-Mexico border in Texas) "I could not see the words on Melania's jacket when she boarded Air Force One. I only heard about it once airborne. But there was no way I was going to miss it again, and to my utter astonishment, she was wearing it once more upon her return to Washington." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (A White House staff member reaches for the microphone held by CNN's Jim Acosta as he questions President Trump during a news conference following the midterm congressional elections) "Covering politics has always felt to me like photographing a live theatre production - the actors and stage are usually set in a familiar way. But even if you've seen a specific play many times, there is always the possibility that there will be something exciting or new. It became obvious during this exchange that the dialogue was going in a different direction than expected, and I took it as a cue to make sure I gave the scene extra attention." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (Trump boards Air Force One for travel to Ohio) "We photograph departures and landings hundreds of times. Sometimes, as in this case, the clouds or the light can give you a little gift." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (Donald and Melania Trump stand beside French President Emmanuel Macron and his wife on a visit to the estate of the first US President George Washington) "I'm always happy for events that take us off the White House campus and provide new visual opportunities. This day, when the Trumps feted the Macrons at George Washington's historic estate, it provided just the right contrast for the stylish leader-couples as they took their spots for an otherwise posed moment." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump gestures after arriving in Pennsylvania to take part in the annual September 11 observance) "Celebratory fist pumps on a national day of mourning and reflection caught even the most seasoned of us off guard." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Peter Nicholls (Demonstrators fly a baby Trump blimp in London's Parliament Square, during his UK visit) "I took this picture of the Trump blimp from a wall at the back of Parliament Square, to get a clear view from above the crowd, as it was revealed for the first time, prior to a day of protests during his visit to the UK, mid-July." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (President Donald Trump and North Korea's leader Kim Jong-un walk together before their working lunch during their summit in Singapore) "On a historic and difficult day, it was fun to look for the odd angle or expression. Here, Trump and Kim walk away after impromptu remarks to reporters - which clearly pleased the North Korean leader." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Ronen Zvulun (Ivanka Trump and US Treasury Secretary Steven Mnuchin stand next to the dedication plaque at the new US embassy in Jerusalem) "I shot this picture when I was standing on a platform really close to Ivanka Trump. I knew exactly where to stand and what lens to use because I did a tour the day before. I knew this was the key picture we had been waiting for since the story broke some weeks before." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (The imprint of French President Emmanuel Macron's thumb across the back of Trump's hand at a bilateral meeting at the G7 Summit) "This is taken right after the first photo-op the two presidents had at the G7 summit after they had a tense back-and-forth on Twitter. They were smiling but Macron gripped Trump's hand quite hard and I noticed that it left a visible impression on Trump's hand." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump meeting with Russian President Vladimir Putin in Helsinki) "Body language can give an ordinary photo much more meaning, and here, Trump and Putin did not disappoint." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Joshua Roberts (A father of a Florida shooting victim tries to shake hands with Brett Kavanaugh during his US Senate Judiciary Committee confirmation) "This moment happened in a break in testimony. Kavanaugh seemed surprised as Guttenberg approached but as he turned away he looked anxious. Kavanaugh later said he did not understand who Guttenberg was at the time." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlo Allegri (First lady Melania Trump visits the Pyramids in Cairo) "The First Lady had taken a tour of African nations and could not depart the continent without a visit to the incredible pyramids of Egypt where I, as part of the traveling press pool, was able to make this photo of her looking out over Giza Pyramid Complex." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Brian Snyder (Trump and Germany's Chancellor Angela Merkel hold a joint news conference in the White House) "The East Room felt tense even before President Trump and Chancellor Merkel entered for their joint news conference. With Merkel's podium behind the President's from my vantage point, she seemed to want to keep an eye on him. The East Room was very full for the joint news conference, with photographers on ladders all around the perimeter." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (White House counselor Kellyanne Conway gives an interview at the White House) "This is a fairly common scene at the White House, especially with Kellyanne Conway. Often the press will wait yards off while she or another member of the Trump administration gives a live interview. Conway will then walk past the rest of the press, and everyone hopes that she will give another interview to the group." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Francois Lenoir (President Trump attends a meeting of the North Atlantic Council during a NATO summit in Brussels) "I like the contrast in the photograph. The presence of U.S. President Trump posing smiling and the lack of interest of the officials in the background." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (Thomas Musolino wears a mask of President Trump while holding his daughter Gianna during a Trump campaign rally) "The President's rallies are well-known at this point, we attend a lot of them as members of the White House travel pool. This father-daughter situation really stood out from the crowd because of the juxtaposition of the mask and the tenderness between the two of them." REUTERS/Leah Millis SEARCH "TRUMP POY" FOR FOR THIS STORY. SEARCH "REUTERS POY" FOR ALL BEST OF 2018 PACKAGES. TPX IMAGES OF THE DAY. LEAH MILLIS Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump observes a demonstration with US Army 10th Mountain Division troops as he visits Fort Drum) "President Trump often talks about how much he likes big planes and tanks, and the 'beautiful military.' This summer he had a up-close look during a visit to a military base in New York state, where he signed the National Defense Authorization Act." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jim Bourg (Christine Blasey Ford closes her eyes as she is sworn in before testifying to the Senate Judiciary Committee confirmation hearing for Trump's Supreme Court nominee Judge Brett Kavanaugh) "The moment looks peaceful as if Christine Blasey Ford had closed her eyes in thought, but the image actually reflects the fact that in the nine seconds that she had her hand up to be sworn in to testify, she blinked several times. Blasey Ford began her testimony by saying: 'I am here today not because I want to be. I am terrified. I am here because I believe it is my civic duty to tell you what happened to me while Brett Kavanaugh and I were in high school.'" REUTERS/Jim Bourg SEARCH "TRUMP POY" FOR FOR THIS STORY. SEARCH "REUTERS POY" FOR ALL BEST OF 2018 PACKAGES. TPX IMAGES OF THE DAY. JIM BOURG Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (Supporters listen as President Trump speaks during a campaign rally in Montana) "As a White House photographer I'm always looking for a way to connect the President, Donald Trump, with a place. Before the mid-term elections Trump spent six days campaigning across the country, and at most of the rallies the visual elements were so similar that it was impossible to say whether we were in Florida or Alaska. In this case, though, the context was obvious. We arrived at a rally in Montana and I noticed a group of Native Americans wearing traditional headdresses behind the podium. For me this was the picture of the day." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (Trump meets with supporters from a group called "Bikers for Trump" at the Trump National Golf Club in New Jersey) "President Trump likes to be celebrated by supporters, and none better than a group known as "Bikers for Trump," who visited him at Trump National Golf Club in Bedminster, New Jersey, this summer. Unfortunately, it poured down that day and plans for an outdoor event gave way to a short visit inside the clubhouse for a group photo." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (A protester is removed during acting CIA Director Gina Haspel's testimony at her Senate Intelligence Committee confirmation hearing) "Just like sports, you have to follow the action. This time, I followed it out of the hearing room and into the hallway." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (President Trump speaks at the International Association of Chiefs of Police Annual Convention) "I took this photograph as the pool was being ushered out to leave right before Trump's speech was supposed to end. These are the images we take after we have taken the literal, newsy ones." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump and Melania at the Flight 93 National Memorial) "A somber moment, this image came together because of the scale and symmetry of the wall panels and the people in the photo." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (US Secretary of State Mike Pompeo awaits the start of a news conference) "I always say that as photojournalists we photograph through the lens of the lives we live, including the books we read, the music we listen to, the movies we watch. As I was waiting for President Trump to arrive at an event one day, I noticed US Secretary of State Mike Pompeo standing right behind me in classic dark sunglasses. The image of John Belushi in the movie "The Blues Brothers" crossed my mind." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump speaks during the commemoration ceremony for Armistice Day at the Suresnes American Cemetery and Memorial in Paris) "During a recent visit to France and just days after a gunman opened fire at a Pittsburgh synagogue, President Trump visited a WWI cemetery to honor American soldiers. As he spoke, I noted a gravestone at a side angle Ã‘ a single Star of David in the middle of rows and rows of crosses. I felt in this moment, the image carried more meaning than the words." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (Alex van der Zwaan goes through security at the US District Court after arriving for his sentencing) "Everyone has to go through security, no matter who you are. He seemed to embrace the inevitable as the woman with the wand asked him to turn around, facing him back towards the doors where many of the news media were still gathered." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump speaks at a campaign rally in Missouri) "In a last push before the mid-term elections, President Trump traveled for six consecutive days, attending two or three rallies a day, to boost Republican candidates. Most of the rallies were held in airport hangars for an easy flight in and out. Sometimes, the rallies were held in the middle of the night, like this one at Columbia Regional Airport in Columbia, Missouri." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (President Trump holds his prepared questions as he hosts a listening session with high school students and teachers to discuss school safety at the White House) "This event was loaded with raw emotion as school shooting victims from across the country described their experience as student-survivors or as friends and family who never stop mourning dead children. President Trump was given a hand-written card by one of his aides to help him navigate the emotional meeting, and pictures of the card helped tell the story of the day." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump behind the reflection of a House chamber railing as Trump delivers his State of the Union address to a joint session of the US Congress) "The State of the Union speech is one of the most important political events at the beginning of the year. We usually photograph it from several fixed positions, but this year I was assigned to be the 'rotating' photographer, meaning I could move around on the balcony and shoot from different angles, but only during short windows of time. During one of those windows, I found an interesting play of light reflected off a gold-colored railing, which, at a certain angle, could be seen to fall over the president." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (President Trump arriving at Nashville International Airport) "One of my favorite photographers, Sam Abell, likes to quote his father: "Bad weather makes good pictures." In addition to the weather, the controlled chaos of White House press handlers and Secret Service agents help make pictures like this possible." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (White House Communications Director Hope Hicks leaves after attending the House Intelligence Committee closed door meeting) "This is the product of about seven hours of waiting and lots of team work involving constant coordination to guess where to wait in order to capture Hope Hicks as she left the hill. Luckily, there were several cameramen along for the moment and their lighting captured her perfectly." Reuters

The fight left both parties dead set against another shutdown. That sentiment weakened Mr Trump's hand and fuelled the bipartisan deal, a pact that contrasts with the parties' still-raging differences over health care, taxes and investigations of the president.

The product of nearly three weeks of talks, the agreement provides almost $1.4 billion for new barriers along the boundary. That's less than the $1.6 billion for border security in a bipartisan Senate bill that Mr Trump spurned months ago, and enough for building just 55 miles of barricades, not the 200-plus miles he'd sought.

Notably, the word "wall" — which fuelled many a chant at Mr Trump campaign events and rallies as president — does not appear once in the 1,768 pages of legislation and explanatory materials. "Barriers" and "fencing" are the nouns of choice.

The compromise would also gradually pressure Immigration and Customs Enforcement, or ICE, to gradually detain fewer unauthorized immigrants. To the dismay of Democrats, it would still leave an agency many of them consider abusive holding thousands more immigrants than it did last year.

The measure contains money for improved surveillance equipment, more customs agents and humanitarian aid for detained immigrants. The overall bill also provides $330 billion to finance dozens of federal agencies for the rest of the year.

Donald Trump says Ilhan Omar should resign over Israel comments: 'Anti-semitism has no place in Congress'

Mr Trump has talked for weeks about augmenting the agreement by taking executive action to divert money from other programs for wall construction, without congressional sign-off. He might declare a national emergency, which has drawn opposition from both parties, or invoke other authorities to tap funds targeted for military construction, disaster relief and counterdrug efforts.

Those moves could prompt congressional resistance or lawsuits, but would help assuage supporters dismayed that the president is yielding.

Representative Mark Meadows, who leads the hard-right House Freedom Caucus, told reporters "it would be political suicide" if Mr Trump signs the agreement and did nothing else to find added money.

The measure was expected to be carried by pragmatists from both parties. Many of Congress' most liberal members were expected to oppose it, unwilling to yield an inch to Mr Trump's anti-immigrant policies, while staunch conservatives preferred a bill that would go further.

"I made a promise to my community that I wouldn't fund ICE," said Representative Alexandria Ocasio-Cortez, a freshman who's become a face of her party's left wing and a leading proponent of eliminating the agency.

Though Mr Trump lost the highest-profile issue at stake, he all but declared victory Wednesday.

At the White House, he contended that a wall "is being built as we speak." Work on a small stretch of barriers is due to start this month in Texas' Rio Grande Valley under legislation Congress approved last year.

Swallowing the deal would mark a major concession by Mr Trump, who has spent months calling the situation at the southern border a national security crisis.

In private conversations, Mr Trump has called the congressional bargainers poor negotiators, said a person familiar with the conversations who wasn't authorized to speak publicly. Mr Trump has also made clear that he wanted more money for the wall and has expressed concern the plan is being framed as a defeat for him in the media.

Mr Trump has repeatedly vowed Mexico would pay for the wall, a suggestion that country has spurned. His descriptions of the wall's size have fluctuated, at times saying it would cover 1,000 of the 2,000-mile boundary. Previous administrations constructed over 650 miles of barriers.

Facing opposition from Mr Trump, Democrats lost their bid to include language giving federal contractors back pay for wages lost during the last shutdown. Federal workers have been paid for time they were furloughed or worked without paychecks.

Also omitted was an extension of the Violence Against Women Act. Democrats say this will give them a chance later this year to add protections for transgender people to that law.