A doctor got pulled over for speeding. Instead of a ticket, the officer gave her masks.

A cardiologist who was pulled over for speeding on a Minnesota interstate said she was deeply touched when the trooper gave her face masks instead of a ticket.

Sarosh Ashraf Janjua wrote in a Facebook post Friday that when a Minnesota state trooper pulled her over and looked at her Massachusetts license, he asked her what she was doing so far from home.

She told him that she travels to the state every month to work as a fill-in cardiologist.

Janjua, 37, wrote that the trooper went to his car to scan her license plate number and firmly told her that "it was very irresponsible of me to be speeding, especially since I would not only take up resources if I got into an accident, but would also not be in a position to help patients."

RELATED: Take a look at the first round of coronavirus vaccine trials in Seattle:

The Minnesota State Patrol has shared on Facebook that more people were speeding and driving aggressively in the midst of the coronavirus pandemic. "Col. Matt Langer is asking Minnesota motorists to do their part to make sure hospital beds are available for those dealing with COVID-19," MSP said in a statement.

Janjua wrote that she felt "thoroughly chastised," and waited for the trooper to hand her a ticket.

"Instead, he told me he was going to let me off with a warning," Janjua wrote. "As I sputtered to apologize and say thank you, he reached in to hand me what I assumed was my license back."

"It wasn’t until my hand had closed around what he was giving me that its unexpected bulkiness drew my eyes to it," she wrote. "Five N95 masks, from the supply the state had given him for his protection."

Janjua said the gesture brought her to tears and "though it may just have been the cold wind, I think he teared up a little as well, before wishing me well and walking away."

A statement that the state patrol shared with NBC News said the trooper who gave Janjua his masks was Trooper Brian Schwartz. Janjua told him that she was working as a cardiologist at a quarantine unit in Duluth, and he noticed two used masks in her bag, which led him to believe she was reusing them.

"Trooper Schwartz said he heard there was a shortage of personal protective equipment (PPE) and thought Ashraf could use the extra masks," the statement said. "Troopers are working hard during the pandemic and are thinking about all the first responders who are caring for Minnesotans during this critical time."

On Facebook, the state patrol thanked Janjua for "her hard work and dedication."

Janjua said she was worried about running out of PPE during the pandemic "like all healthcare workers and emergency responders around the world."

"And in my darkest moments, have worried about what would happen if I fell sick far from home," Janjua shared.

"This complete stranger, who owed me nothing and is more on the front lines than I am, shared his precious masks with me, without my even asking," she wrote. "We are going to be ok."