An armed man who engaged in a five-hour standoff at a Panera Bread near Princeton University in New Jersey on Tuesday was fatally shot by police, the state attorney general's office said in a statement.

The suspect, whose name was not released, was shot shortly before 3 p.m. after attempts by police to negotiate with him were unsuccessful, officials said.

The individual "was pronounced dead at the scene," the attorney general's office said in the statement, and no one else was reportedly injured during the incident.

It was not clear what sparked the standoff that began around 10 a.m. Officials said they are investigating.

Princeton police said the unidentified man armed with a gun reportedly entered the chain eatery on Nassau Street, issuing threats inside. Employees and customers fled as police swarmed the location.

Police said just after 2 p.m. that the situation remained contained and they continued to ask residents to stay away from the area near the Ivy League university campus.

Police Chief Nick Sutter earlier told Planet Princeton that authorities were trying to negotiate with the gunman. The man could be heard on the police scanner saying “no one is coming through those doors.”

Sutter said at the time that police did not know if anyone else was still inside the building. He said the situation was contained.

Armed officers were staged outside the restaurant with their weapons drawn while negotiations continued.

The local newspaper reported police believed they found the man's vehicle - a Ford Focus with Pennsylvania license plates.

The university sent out an alert to students and faculty. On its website, officials said two nearby campus buildings - Henry House and Scheide Caldwell House - were being evacuated.

"It is not known whether the gunman has any connection to the University," the university said. "Classes are not in session, as this is the week of spring break."

A second alert sent out to the Princeton University community saying there was a shelter-in-place and shots fired was sent out as a mistake.

"Some University community members received a PTENS telephone call that incorrectly said shots had been reported and a shelter-in-place order was issued," the university tweeted. "NO SHOTS WERE FIRED; THERE IS NO SHELTER-IN-PLACE order. Continue to avoid the area."

Princeton public schools were sheltering in place due to the incident.

“PHS is monitoring situation in town and we are in ‘shelter-in-place’ status as a precaution,” Gary Snyder, principal at Princeton High School, tweeted. “'Shelter-in-place' keeps us secure indoors, instruction able to continue and on stand-by for updates.”

Tom Morrison, a retired sheriff's deputy from Kern County, California, told NJ.com he was at a Starbucks nearby on Nassau Street when he saw the police arrive.

"I ran outside to get some of the people who came to look behind the perimeter," Morrison said. "The police were operating with efficiency. They were putting up the perimeter pretty fast."

Fox News' Elizabeth Zwirz and The Associated Press contributed to this report.