A top congressman was among five people wounded as a gunman sprayed bullets at Republican lawmakers during baseball practice in a Washington DC suburb.
House of Representatives Majority Whip Steve Scalise was expected to survive after the early morning attack at a park in Alexandria, Virginia.
Two police officers suffered non-life threatening bullet wounds as they fired back at the attacker.
Officials have identified the gunman as Illinois resident James T Hodgkinson.
Police had earlier said the gunman was one of five people taken to the hospital.
Alexandria police tweeted: “Suspect is in custody and not a threat.”
The lawmakers were practising for the annual congressional ballgame scheduled to be played on Thursday at Nationals Park, home of Major League Baseball team the Washington Nationals.
Alexandria police said the FBI was taking over the investigation into the shooting, which began shortly after 07:00 (11:00 GMT) on Wednesday morning at Eugene Simpson Stadium Park.
Donald Trump said in a statement: “We are deeply saddened by this tragedy. “Our thoughts and prayers are with the members of Congress, their staffs, Capitol Police, first responders, and all others affected.”
Mr Scalise was shot in the hip was said to be in “good spirits” before he was taken in for surgery.
He was “doing well” after his operation, House Majority Leader Kevin McCarthy said.
Senator Mike Lee, a Utah Republican, said someone had used a belt as a tourniquet on Mr Scalise at the baseball field.
Texas congressman Roger Williams’ office said one of his staff, legislative correspondent Zack Barth, was wounded in the attack.
Kentucky Senator Rand Paul told Fox News: “I do believe without the Capitol Hill police it would have been a massacre.
“We had no defence at all. The field was basically a killing field.”
He said they were lucky that Mr Scalise was present because he has a security detail owing to his congressional seniority.
Mo Brooks, an Alabama Republican, told CNN he was on third base during the baseball game when he saw Mr Scalise, who was on second base, shot.
He said Mr Scalise had a bullet hole in his leg, but was saying: “I’m OK, I’m OK.”
Mr Brooks said everyone on the field scattered as 50 to 100 shots were fired.
He said a gunfight had ensued between the shooter and the congressmen’s police security detail, who were armed with pistols.
Mr Brooks said the gunman was armed with a rifle and was “blasting away” from behind the dugout, using it for protection.
The congressman, who said he took refuge behind a batting cage, described the attacker as a middle-aged white male, “a little on the chubby side”.
Mr Brooks said congressmen Chuck Fleischmann, of Tennessee, Ron DeSantis, of Florida, and Jeff Duncan, of South Carolina, were among 15-25 lawmakers at the game.
Asked by a CNN host if the attack was deliberate, Mr Brooks replied: “Well, it sure as heck wasn’t an accident!
“He was going after elected officials, congressmen.”
Mr Brooks continued: “The only weapon I had was a baseball bat and that’s not the kind of fight you want to engage in.”
Ohio congressman Brad Wenstrup, who served in Iraq as a combat surgeon from 2005-06, provided medical care at the scene.
He told CNN the shooter eventually resorted to a pistol, having apparently used up all his rifle ammunition.
A lot of ammo
Arizona Senator Jeff Flake told reporters he was at bat during the shooting and the victims were “sitting ducks”.
He said the attack had lasted for at least 10 minutes, adding: “He had a lot of ammo.”
Mr Flake added: “There are two of his [Mr Scalise’s security] detail were shot, one African-American gentleman shot in the leg and I believe he’s the one that brought the shooter down.
“He ran around for quite a while with a leg wound, returning fire.”
Alexandria Police Chief Michael Brown said his officers had responded and engaged the shooter within three minutes.
The last member of Congress to be targeted by a gunman was Democrat Gabrielle Giffords, who was shot in the head as she met constituents in Tucson, Arizona, in January 2011. She survived, but six others died in that incident.
Ms Giffords tweeted on Wednesday: “My heart is with my former colleagues, their families & staff, and the US Capitol Police- public servants and heroes today and every day.”
The top Republican in the House of Representatives, Speaker Paul Ryan, said “the hearts of the whole House” were with the victims.
One eyewitness was outraged that the gunman should have targeted a game known as the nation’s pastime.
Noah Nathan told NBC News: “Baseball is America’s game! You don’t mess with baseball.”