A man carrying two gas cans, lighter fluid and lighters tried to enter St. Patrick’s Cathedral in New York City on Wednesday but was stopped by a security officer and taken into custody, an NYPD official said.

"Nothing happened inside the cathedral," the Archdiocese of New York said in a statement.

There was no fire, but there were people inside and the building was open at the time of the incident. Three senior law enforcement officials said the man may be emotionally disturbed.

The archdiocese said that "the individual was stopped as he tried to come into the cathedral," and he was turned over to police.

The incident comes days after the historic Notre Dame Cathedral in Paris burned in what officials in France say appears to have been an accident, as renovation work was being done at the time it broke out.

The NYPD said it maintains a robust security presence at St. Patrick's at all times, but that it had added to that in recent days.

Law enforcement sources told NBC News that the man taken into custody is Marc Lamparello, 37, of New Jersey. Lamparello is listed as a doctoral candidate and adjunct lecturer in the City University of New York's philosophy department.

Marc Lamparello

NYPD Deputy Commissioner of Intelligence and Counterterrorism John Miller said at a news conference Wednesday night that the man was stopped shortly before 8 p.m. by a security officer at the cathedral.

The man pulled up in a minivan on Fifth Avenue and left the car. Around 7:55 p.m., he returned to the minivan and took out two 2-gallon cans of gasoline, a plastic bag with two bottles of lighter fluid and two lighters and tried to enter the cathedral, Miller said.

"As he enters the cathedral, he is confronted by a cathedral security officer who asked him where he’s going, informs him he can't proceed into the cathedral carrying these things," Miller said. "At that point some gasoline apparently had spilled out onto the floor."

Two counterterrorism police officers outside were notified and caught up with the man on 50th Street, Miller said. “His answers were inconsistent and evasive,” he said.

"His basic story was that he was cutting through the cathedral to get to Madison Avenue, that his car had run out of gas," Miller said. “We took a look at the vehicle. It was not out of gas.”

He was then taken into custody, Miller said. He did not make any statements about Notre Dame in his initial statements, Miller said.

St Patrick's Cathedral. NBC News

"It's hard to say exactly what his intentions were," Miller said, noting that the man in custody is known to police.

"We are looking into his background, obviously, and talking to a couple of other agencies,” Miller said. The FBI’s joint terrorism task force is involved “out of an abundance of caution," he said, "because we don’t know exactly what his mindset was, what his motive was.”

"But we do know that carrying two cans of gasoline and the equipment to light that, to a public area and a place like St. Patrick’s Cathedral is something that presents a danger to the public, and that’s why he’s in custody," Miller said.

During a news conference Thursday morning to announce a fundraising campaign to support the rebuilding of Notre Dame, Cardinal Timothy Dolan, head of the New York archdiocese, praised the church's security team and the police for quickly removing Lamparello from the church and taking him into custody.

New York City Councilman Justin Brannan tweeted that police would be increasing their presence around churches and religious institutions on Thursday as a precaution.

The cornerstone of the iconic Midtown Manhattan church was laid in 1858, and it formally opened May 25, 1879, according to the cathedral’s website. Pope Benedict XVI became the first pope to celebrate Mass there in 2008.

The cathedral has undergone renovations since, including a nearly $200 million restoration that was announced in 2015 and completed a year later, NBC New York reported.