It happened around 6:48 p.m. on the 3 train platform at the Pennsylvania Avenue subway station in East New York.
The officer first warned the 24-year-old man to put out the cigarette, but he apparently ignored the warning.
Then, the suspect threw himself down the stairs and police say he tried to drag the officer down the steps as well.
At the base of the stairs, a struggle ensued with the man allegedly trying to grab the officer's gun several times.
Alex Eremin was placed under arrest and taken to Brookdale University Medical Center for a medical evaluation.
Eremin, who is homeless, is now facing charges of attempted robbery, assault on a police officer, resisting arrest, obstructing governmental administration, assault, disorderly conduct, violation of railroad laws, and harassment.
The officer was transported to New York-Presbyterian Brooklyn Methodist Hospital in stable condition.
Police say the transit officer was on solo patrol at the time.
After the attack Tuesday evening, the police union president and the mayor agreed to modify train patrols.
Now, two officers will walk through train cars in separate directions but stay within eyesight of each other.
In addition, the city and MTA are launching a campaign to teach riders how to be safe passengers.
"We are going to move with the MTA to put in place a massive campaign on how to be a safe passenger," Adams said. "While I was out I saw women passengers in isolated areas standing alone. That is just unsafe. So we must play a role of educating passengers how to be partners in safety."
One of those safety tips includes riding in the conductor's car when it's late at night.
ALSO READ | College basketball star killed in NYC mass shooting
College basketball star killed after 9 shot in Harlem
----------
* Get Eyewitness News Delivered
* More Manhattan news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Follow us on YouTube