WASHINGTON — When James Hodgkinson got into trouble, it was often with a gun.

And when he got angry about politics, it was often directed against Republicans.

On Wednesday, those two elements apparently brought the 66-year-old southern Illinois man to the edge of an Alexandria, Virginia, ball field, where GOP congressmen were practicing for an upcoming charity game.

He allegedly asked people there, "Are these the Republicans or the Democrats?"

Then, from the edge of the third-base dugout, he took up a high-powered rifle, aimed at the players, and began firing, authorities said.

He hit three, including a ranking member of the House of Representatives, Majority Whip Steve Scalise, and a Capitol Police officer assigned to protect him. Then officers gunned him down.

While Hodgkinson's motivations remain under investigation, his online presence, seemingly as a passionately anti-Republican commenter, has fueled speculation that the attack was politically motivated.

Not long after the gunman's identity became known, U.S. Sen. Bernie Sanders of Vermont, a face of left-wing resistance, said he heard that Hodgkinson "apparently volunteered" for his 2016 presidential campaign.

“I am sickened by this despicable act,” Sanders said in a statement. “Let me be as clear as I can be. Violence of any kind is unacceptable in our society and I condemn this action in the strongest possible terms.”

Hodgkinson, a licensed home inspector who ran his business out of his Illinois home, has a history of arrests, including a 2006 incident in which he allegedly pulled a gun on a man who went to his house to confront him about hitting the man's girlfriend.

The man accused Hodgkinson of hitting him in the head with the gun's wooden stock and, as he ran way, firing once without hitting the man, according to a police report. The girlfriend told police that the shooting was followed by a violent confrontation that also included Hodgkinson's wife and another woman. In the end, Hodgkinson was charged with domestic battery, battery and aggravated discharge of a firearm. But the case was later dismissed, according to public records.

The same day, another neighbor later told police, Hodgkinson damaged one of her bedroom doors during a search for his daughter, according to a police report. It is not clear how that case ended.

Related: Which Lawmakers Were Attending Baseball Practice Where Scalise Was Shot?

Police also responded to reports of gunshots at his Belleville home — about 20 miles southeast of St. Louis, Missouri — in late March, according to a police report. Callers to 911 reported hearing 50 shots. Police said they found Hodgkinson with a weapon in his possession and a valid Illinois firearms license. They told Hodgkinson not to fire his weapon in that area as there were homes nearby.

James Hodgkinson of Belleville protests outside of the United States Post Office in Downtown Belleville, Illinois on April 17, 2012. A government official says the suspect in the Virginia shooting that injured Rep. Steve Scalise and several others has been identified Hodgkinson. Derik Holtmann / AP

Hodgkinson, encountered on the property of his rural home with a high-powered rifle, told officers he was taking target practice. "He was very cordial, very nice, very understanding," St. Clair County Sheriff Richard Watson said Wednesday after speaking to one of the responding officers. "He had no reason to think he was doing anything illegal, immoral or anything."

Lyndon Evanko, who represented Hodgkinson in the 2006 case, described his former client as “an odd little guy” and “a bit of a misanthrope.”

“He wasn’t unpleasant. But he wasn’t particularly somebody you would want to hang out with. I got the feeling that he butted heads with a lot of people."

At the same time, Evanko said, Hodgkinson "didn’t seem the least bit political" or “somebody with a great deal of passion about anything."

Evanko added: “Had I not gotten the charge dismissed, he wouldn’t have been able to own a gun. I did my job a little too well.”

Dale Walsh, who described himself as a childhood friend of Hodgkinson’s, told reporters that he knew the shooter as "passionate in what he believed” but "in control."

“I never thought this would happen,” Walsh said.

Hodgkinson was a frequent writer to his local paper, the Belleville News-Democrat, where he railed against income inequality, linking it to the tax policies of the GOP, the newspaper reported.

"I have never said 'life sucks,' only the policies of the Republicans,' he wrote in one letter.

In another, Hodgkinson said his favorite TV program was "The Rachel Maddow Show" on MSNBC.

Hodgkinson’s Facebook postings portray him as stridently anti-Republican and anti-Trump.

"I Hate Republicans & everything they stand for," he wrote in December 2015. On June 3, he shared a caricature of the president as "Maximus Imbecilus." He was a member of several political Facebook groups, including one called "Terminate the Republican Party."

He also used a cartoon of Sanders as Uncle Sam as his profile picture.

A Sanders campaign staffer said Hodgkinson didn't play a significant role in the 2016 campaign.

Other law enforcement officials with knowledge of the investigation told NBC News that at this point there's no indication that the shooter had ties to international terrorism.

Witnesses said the gunman opened fire with a rifle from the third base side of the diamond.

One witness, David Thomas, said he had just left a YMCA gym when the shooting started. He said he saw the gunman pacing from one end of the third base dugout to the other, firing multiple rounds then stopping to shout things like "get out of here."

He briefly took cover with Laura Russell, who said she then ran home, where she saw pictures of the gunman and recognized him as someone she often saw in the early morning at the YMCA working on a laptop. Russell said she never saw the man working out, which she found odd. But "he was friendly," she said.

Bill Euille, the former mayor of Alexandria, told MSNBC that he'd started seeing Hodgkinson at the local YMCA about the a month and a half ago, and even talked to him about helping him find employment.

"I would mostly encounter him around between 8:30/8:45 when I finished my workout, and he would be sitting in the lobby, the main entrance area of the Y and he would sit there having coffee and then have a laptop," Euille said.

Another witness, Kaya Ovington, who lives across from the YMCA, said she recognized Hodgkinson as a man who had spent the last few weeks hanging out around neighborhood.

"He’s been transient, so I’ve seen him in the neighborhood," she said. "No real — he hasn’t been in a car that I’ve seen. But just walking around the neighborhood, sleeping on a bench in the park, sometimes sitting behind the, on a curb behind the CVS, just around."

Two firearms, a rifle and a handgun, were recovered from the scene, the Bureau of Alcohol, Tobacco, Firearms and Explosives said.

Related: Congressman Steve Scalise, Three Others Shot at Alexandria, Virginia, Baseball Field

Two members of a dignitary protection unit of the U.S. Capitol Police were wounded. Earlier it was believed that both officers had been shot, but law enforcement officials later said one of the officers had sustained an ankle injury.

The other reported victims, Scalise of Louisiana, a congressional staffer and a lobbyist with Tyson Foods, were all expected to survive.

Pete Williams reported from Washington. Jon Schuppe, Tom Winter, Jonathan Dienst and Donna Mendell reported from New York. Chris Jansing reported from Alexandria.

CLARIFICATION (June 14, 1:50 p.m.):An earlier version of this article said that Hodgkinson was arrested in 2006 for assaulting his girlfriend. The nature of Hodgkinson's relationship with the victim is not clear.