WASHINGTON — The man suspected of opening fire on Republican members of the congressional baseball team early Wednesday morning was distraught over the election of President Trump and traveled to Washington in recent weeks to protest, his brother said on Wednesday.

The suspect, James Thomas Hodgkinson, 66, of Belleville, Ill., died in a Washington hospital after a shootout with the police.

“I know he wasn’t happy with the way things were going, the election results and stuff,” his brother, Michael Hodgkinson, said in a telephone interview shortly after he received the news on Wednesday. He added that he was not close to his brother and had not been aware why he remained in Washington.

“Totally out of the blue,” he added, saying that his brother was engaged in politics but otherwise led a normal life.

Michael Hodgkinson said his sister had spoken with the shooting suspect’s wife on Tuesday. According to his account, the wife said that Mr. Hodgkinson had called home to say he was planning to come home because he missed his wife and dogs.

Mr. Hodgkinson, who goes by Tom, owns a home-inspection business on the rural outskirts Belleville, a Southern Illinois town of more than 40,000 just across the Mississippi River from St. Louis. Records show that his inspection license, registered to a company called JTH Inspections, expired last November and had not been renewed.

Mr. Hodgkinson lived about 100 yards off a rural road in a two-story, seemingly well-kept home with tan vinyl siding.

Charlene Brennan, a real estate agent in Belleville, said Mr. Hodgkinson had conducted some home inspections as a part of sales she worked on over the years.

“He did not come off as a radical,” Ms. Brennan said. “He did not come off as an unstable individual. He wasn’t belligerent; he was just kind of a normal guy.”

Still, social media accounts that appear to be affiliated with Mr. Hodgkinson show a man deeply connected to liberal politics and distrustful of Republican-controlled Washington. In posts, he rails against Republicans, lavishes praise upon Senator Bernie Sanders of Vermont, the one-time presidential candidate, and shows a deep engagement with churn of news coming out of Washington.

In letters to the editor of his local newspaper, in 2012, he argued assiduously for a range of Democratic positions.

Just Tuesday morning, Mr. Hodgkinson posted a cartoon on Facebook explaining “How does a bill work?” “That’s an easy one, Billy,” the cartoon reads. “Corporations write the bill and then bribe congress until it becomes law.”

“That’s Exactly How It Works…..” Mr. Hodgkinson wrote.

On Monday, he posted a Yahoo News article about Mr. Trump’s most recent cabinet meeting, in which cabinet members went around the table and praised the president. He added his own sharp critique to the posting.

Mr. Hodgkinson’s Facebook page was filled with references to Mr. Sanders, who lost the Democratic primary nomination to Hillary Clinton but has remained active in calling for Democrats to endorse more progressive policies.

His Facebook profile picture was an image of Mr. Sanders dressed up as Uncle Sam.

Mr. Sanders said in a statement on Wednesday that he was aware Mr. Hodgkinson had volunteered for his presidential campaign. And he condemned violence of any type.

“I am sickened by this despicable act,” Mr. Sanders wrote. “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.”

According to the Saint Clair County Clerk’s Office, where Mr. Hodgkinson is registered to vote, he has repeatedly elected to vote in Democratic primaries in recent years. There was no party affiliation listed on his voter file.

A query to the St. Clair County Sheriff’s Department showed a number of complaints in recent years, mostly after run-ins with neighbors. In late March, the sheriff responded to a report of man firing dozens of shots near Mr. Hodgkinson’s home. When authorities arrived, they found Mr. Hodgkinson and advised him not to shoot in the area. An incident report indicates that he presented a valid firearms owner identification card.

A law enforcement official said that on Wednesday that Mr. Hodgkinson was armed with a handgun and a rifle.

Hours after the shooting, Dale Walsh, who identified himself as one of Mr. Hodgkinson’s friends, appeared near the home and said that he was stunned by the shooting.

Mr. Walsh knew Mr. Hodgkinson as Tommy and said he had been a vibrant presence when he was younger.

“He wasn’t evil,” he said. “I guess he was tired of the politics.”

Mr. Hodgkinson appears to have been residing in Alexandria for more than a month. Most mornings, he could be found at the city’s YMCA, according to William D. Euille, the city’s mayor from 2003 to 2016, who works out at the facility each morning.

The two men struck up a relationship, Mr. Euille said, and Mr. Hodgkinson gave the impression of a typical, if lonely, newcomer to an area that is used to new faces.

“He seemed like a loner,” Mr. Euille said, “but very nice.”

He worked out in the gym and showered in the facility’s locker room, Mr. Euille said. He made small talk about politics and old movies, and asked the mayor about finding work in town and good places to eat. Most days, Mr. Euille said, he would sit — often for hours at a time — in a small reception area using his laptop.

That was the case Tuesday morning as well, Mr. Euille said. Twenty-four hours later, Mr. Hodgkinson unleashed his attack just a few paces from the gym’s front door, on the well-groomed baseball diamond where the congressmen were practicing.