WASHINGTON — Two police officers at the Pentagon were wounded Thursday evening when a man walked up to the entrance of the complex’s subway station and, without a word, opened fire on them, Pentagon officials said.

Police officers quickly returned fire, critically injuring the gunman after hitting him once in the head and once in the shoulder. The gunman was identified as John Patrick Bedell, 36, according to a police official here assisting with the investigation.

The injured police officers, whose names were not released, were wearing ballistic vests and were taken to a hospital with non-life-threatening injuries, according to Richard S. Keevill, the Pentagon police chief.

Pentagon officials said late Thursday that the motive for the shooting remained unclear. One official said investigators also were trying to determine whether the gunman had acted alone. A police official said the gunman was seen on a surveillance video near the Pentagon talking to another man. But the official added that district police were informed almost immediately after the shooting that there was only one suspect.

The shooting took place around 6:40 p.m. at the entrance to the subway station across the street from the Pentagon building, which was the site of one of the terrorist attacks on Sept. 11, 2001.

After that attack, new security measures were put in place at the Pentagon and part of the building was redesigned. Subway passengers are no longer permitted to exit directly into the Pentagon; they must be screened outside before entering the building.

Officials said the gunman approached the two officers at a security screening area outside the complex and reached into his pocket, pulling out what the officers thought would be a Pentagon pass. Instead, the man took out a handgun and started shooting at them, prompting the officers to fire back.

“They said he walked up very cool, like there was no distress,” Chief Keevill said, quoting the officers. “He had no real emotion in his face.”

Witnesses told news stations that they heard gunshots and saw people screaming and scrambling to get out of the area.

Asked to describe the gunman and his nationality, Chief Keevill said only, “He’s an American citizen as far as I know."

Late Thursday, investigators were running the suspect’s name through government databases to determine whether he had known links to terrorist organizations or criminal groups, Pentagon officials said.

Military service records also were being checked to see whether the suspect had ties to the armed forces.

Messages posted on the Web under the username JPatrickBedell seemed to share some biographical details with the shooter and pointed to a distrust of the military and the government at large. “I am determined to see that justice is served in the death of Colonel James Sabow, as a step toward establishing the truth of events such as the September 11 demolitions,” the user wrote, referring to the suicide of an Army officer in 1991.

A 2006 arrest report for a man identified as John Patrick Bedell, then 33-years-old, appeared to connect to the user JPatrickBedell, who wrote: “My desire for justice led me to violate what I think is one of the most unjust laws, cannabis prohibition, by growing 16 cannabis plants on my balcony in Irvine, CA from March 2006 to June 2006.”

The police were investigating whether the Internet postings were made by the shooter, Chief Keevil said at a news conference Friday morning. The Pentagon was briefly locked down after the incident. The subway entrance was closed for about two hours.

Shortly after the shooting, officers with military-style weapons fitted with flashlights were seen patrolling the area around the Pentagon, apparently looking to ensure there were no other gunmen. The subway stop where the shooting took place is a major transfer point for people taking buses to various points in Virginia.

Virginia, which has some of the most lax gun laws in the nation and has been pushing to expand gun rights, has been criticized lately by gun control advocates. The state’s General Assembly approved a bill last month allowing people to carry concealed weapons in bars and restaurants that serve alcohol, and the House of Delegates voted to end a 17-year-old measure barring people from buying more than one handgun a month.

Ian Urbina reported from Washington, and Anahad O’Connor from New York. Thom Shanker and Theo Emery contributed reporting from Washington.