A gunman opened fire on Republican members of Congress during a baseball practice near Washington early on Wednesday, wounding several people including senior Republican leader Steve Scalise, before being taken into custody, police and witnesses said.

The gunman died later of his injuries, President Donald Trump announced at the White House.

Legislators said the attacker, who was armed with a rifle, had exchanged fire with Capitol Hill police who were at the scene and was shot before being taken into custody.

Scalise, the third-most senior figure in the House of Representatives Republican leadership, was shot in the hip at the baseball field in Alexandria, Virginia. He was tended to by fellow legislators including Brad Wenstrup, an Ohio congressman who is a physician, before being transported to a hospital.

Five people were transported medically from the scene, Alexandria's police chief, Michael Brown told reporters. Two of the wounded were Capitol Hill police who were at the scene and who engaged in a gunfight with the attacker, witnesses said.

The suspect was identified by a senior US official as James Hodgkinson from the St. Louis suburb of Belleville, Illinois. Media reports said Hodgkinson, 66, owned a home inspection business.

His social media presence indicated he was strongly opposed to Republicans, including Trump.

Police and the FBI said it was too early to determine a motive in the shooting or whether the attack was an attempted political assassination.

Some 25 to 30 Republican members of the House and Senate had gathered for an early morning practice a day before the annual charity congressional baseball game pitting Republicans against Democrats, said Representative Mo Brooks of Alabama. 

Two Capitol police officers returned fire at the attacker for well over five minutes, witnesses told Al Jazeera [Reuters]

Al Jazeera's Kimberly Halkett, reporting from Washington, DC, said some of the players had given details about an interaction with the gunman just before the shooting.

"Allegedly the shooter, just prior to opening fire on these Republicans, asked whether or not it was Republicans or Democrats who were practising," she said.

In a dramatic blow-by-blow account, Brooks told CNN the gunman was armed with a rifle and appeared to be a white middle-aged male, "a little bit on the chubby side".

He said he saw the man only for a second, and that he was shooting from a chain-link fence behind the dugout near third base position on the field where the congressional group was holding a morning practice.

"There must have been 50 to 100 shots fired," he told CNN. "I hear Steve Scalise over near second base scream. He was shot," said Brooks, adding he helped apply a tourniquet with his belt to a congressional staffer who was shot in the leg.

The security detail for Scalise, the second-ranking member of the Republican leadership in the lower House of Representatives, returned fire when the shooting broke out.

Witnesses told Al Jazeera the attack lasted well over five minutes. 

OPINION: Gun control in the US is not a fantasy

"Eyewitnesses say after the congressman was shot, he actually crawled to the outfield and that's when there was gunfire going back and forth between the suspect and the Capitol police officers here," said Al Jazeera's Gabriel Elizondo, reporting from Alexandria.

"One man told us one of the police officers that was shot was on the ground and still returning gunfire against the suspect."

Al Jazeera's Shihab Rattansi, reporting from Washington, DC, said the exact casualty figures are not yet been established.

"We know that Steve Scalise was shot in the hip, according to his aide; we know two Capitol police officers were shot - one male, one female; we know at least one other person was shot - perhaps in the chest - and then there's the gunman himself who was also shot," he said.

"There may be more casualties."

Police keep watch on Capitol Hill following Wednesday's shooting in nearby Alexandria, Virginia [Reuters]

Rattansi said the congressman and the two police officers are reportedly in a stable condition, but there is no news on the other casualties.

It was unclear whether legislators were targeted for their profession.

Scalise's position as whip in the Republican-controlled House makes him one of the most senior figures in Congress. He is a representative from Louisiana.

In a televised address shortly after the attack, US President Donald Trump called for unity. 

Trump said that despite political differences, everyone should agree that "we are blessed to be Americans" and strongest when "we work together for the common good".

Al Jazeera's Elizondo said the shooting had "rattled" Washington. 

"There were many lawmakers here and people are keenly aware this could have been much worse," he said.

Source: Al Jazeera and news agencies