Two Marines were shot and killed late Thursday at the Officer Candidate School at Marine Corps Base Quantico, and the suspected shooter, also a Marine, fatally shot himself inside a barracks on the base, authorities said.

The shooter gunned down a male Marine before seizing a woman and killing her and then himself, officials said. They declined to publicly discuss a possible motive in the attacks but said the incident was neither a terrorist incident nor an attempt to cause mass casualties.

They said the gunman and two victims were members of the same unit and knew one another. “This was an isolated incident,” said Capt. Eric D. Flanagan, a Marine spokesman at the Pentagon. “At no point was this suspected to be a mass shooting.”

Speaking on the condition of anonymity, a senior military official who works at the Pentagon said a romantic entanglement might have prompted the shootings.

“The most likely explanation is a love triangle,” said the official, who had been briefed on the incident. The official cautioned, however, that the investigation is ongoing.

The base, which also houses the FBI’s training academy, is about 30 miles southwest of Washington in Prince William County.

On Friday, officials did not disclose the names and and ranks of the three dead Marines. They invoked the policy that applies to combat deaths, in which identities of the deceased are withheld until 24 hours after family members are notified.

Thursday night’s shootings occurred in the Taylor Hall barracks at the Officer Candidate School, according to the base commander, Col. David W. Maxwell. He told reporters that all three of the Marines were staff members at the school and that all officer candidates there were safe and accounted for.

He would not say what the three did at the school. Some officer candidates in training at Quantico are experienced Marine Corps enlisted men and women, and others are new to the Marines. Those who complete the course, which lasts about three months, are commissioned into the Marine officer ranks as second lieutenants.

The application process for prospective officers, who must be college graduates, is difficult, and the training is physically and academically rigorous.

“Base is a bit of a somber place today,” said Laura Gleckel Unger, a resident there. “Living in a neighborhood surrounded by families, some of whom work at [the officer school], is always hard. You pray that it isn’t your neighbor or anyone you know, but at the same time you know they will all be affected.”

The first 911 call about the incident came in at 10:30 p.m., but no shots were heard, Maxwell said. He said that, at 11 p.m., the base used a loudspeaker system called the “giant voice” to put the Quantico installation on lockdown.

Marines from the provost marshal’s office and Prince William police officers initially responded to the report of gunshots and suspected that the shooter had barricaded himself inside a building, said Marine Sgt. Christopher Zahn. By 2:30 a.m. Friday, authorities had entered the building and found the three dead Marines.

Zahn said a chaplain was at the base providing support and helping Marines cope with the incident. “We are making sure we are taking care of our Marines and their families as they deal with this tragedy,” he said. “All the details are under investigation.”

“This is truly a tragic loss for the Marine Corps, which has had a number of tragic losses in the last couple of weeks,” Maxwell said in a seven-minute news briefing. He took no questions afterward. “It’s been a long night,” he said.

After reports of the shooting, officials put the base on Force Protection Delta status, which shut down all movement around the base and closed all gates to traffic in and out of the facility for nearly four hours.

Erin Marie Gaith, a Marine spouse who lives on base, jumped on Facebook and learned what the “giant voice” was trying to tell her: There had been a shooting.

Gaith woke up her husband, and the couple locked their doors and windows. They grabbed their 3-year-old daughter, the cat and the dog and holed up in their bedroom. She locked the bedroom door, too. “We didn’t have much detail about what was going on, so I am sure crazy thoughts were running through everyone’s heads,” she said. “I know for me, it did.“

About 3 a.m., residents said, the “giant voice” gave the all clear.

Many people on the base commented in Facebook updates, looking for more information about the shooting. Referring to the public address system, one person wrote, “That speaker is right outside my window so my heart skips a beat each time it goes off!”

Cpl. Emmanuel Ramos, a spokesman for Marine Corps Base Quantico, said there is a lot of grieving on the base. “Our hearts go out to the victims,” he said, “but we do have a mission, and we do press forward.”

Rajiv Chandrasekaran, Paul Duggan, Ian Shapira, Annys Shinn, Josh White, Craig Whitlock and Clarence Williams contributed to this report.