Students across the city met with Mayor Bill de Blasio on Thursday to discuss gun violence, school safety, and greater access to mental health services in the wake of the Parkland school shooting.

"There's never been this much focus and this much energy for change in decades on this issue," de Blasio said during the town hall.

De Blasio and First Lady Chirlane McCray hosted the town hall at the Vanderbilt YMCA in Midtown, fielding questions from dozens of students and some educators for about two hours in the afternoon.

The mayor has held more than 50 town hall meetings, but Thursday's event was different.

It came less than a week before organized school walkouts around the country to protest gun violence.

Wednesday night, Florida's state legislature passed a bill to act on school safety and gun laws, after facing pressure from students from Marjory Stoneman Douglas High School.

17 people were killed in the school in mid-February when a former student went on a shooting spree.

The city education department sent a letter to students' homes Thursday, offering guidance on school attendance policy. It reads that students, if they show up to class in the morning, will not face serious consequences if they walk out for the 17-minute demonstrations and then return to class.

The students gathered Thursday said they were scared and felt unsafe in school.

Many criticized school metal detectors, claiming they are randomly deployed in communities of color.

"In my school, as a person of color, I feel like the school safety officers, they're there more to watch me instead of to help," said a student from Scholars' Academy in Queens.

"What we are trying to create is a world where you say, 'police officer, it means dialogue," de Blasio said.

That answer did not satisfy some students — several dozen protested outside the YMCA after the town hall.

"Let the youth speak!" they chanted at one point.

"Schools are supposed to be an environment where you are supported and where you feel safe," one student said at the protest. "That's not what we feel when we have to go through metal detectors every day. It's dehumanizing. It's traumatizing."

The mayor did not see the protesters.

De Blasio is now turning to national politics: City Hall announced late-Thursday that the mayor was leaving town again for the next five days, crisscrossing the country, pushing his progressive brand. He is slated to go from Baltimore to Austin, Texas, to Washington, D.C., speaking at conferences.

The mayor is scheduled to return to the city Tuesday.

De Blasio is expected to cover topics ranging from infrastructure to economic justice. Taxpayers will foot the bill for the trip at a cost of $8,000.