A gay police officer in Virginia performed a perfectly choreographed dance routine to ‘Formation’ at a school on Friday, and it was amazing.

Deuntay Diggs is a 2nd Lieutenant for the county sheriff’s office in Stafford, Virginia. Diggs executed the exact routine for Beyoncé’s hit at North Stafford High School’s homecoming pep rally.

“I basically learned the choreography the night before I performed it for the first time. I’m a huge Beyoncé fan. So the night before, I just watched her video on Youtube over and over again, and then I memorised it, practiced it, and the next day I did it,” he told Buzzfeed.

The short video which made the rounds on Twitter shows school kids going crazy over the Lieutenant’s dance moves.

The 31-year-old originally called off the performance at the school because he just found out his biological mother has terminal cancer.

“I found out this Tuesday that she only has two months left to live. And so I spent Tuesday and Wednesday in the hospital with her, and had actually cancelled everything.”

“We’re sitting there talking and I said, ‘Well, I want you at my wedding because we’re supposed to dance together.’ And she hasn’t seen any of my dancing videos. So we sat and laughed for a little bit and watched the videos, and she said, ‘Well, I want you to keep on dancing.’ So I came back and I told them I wasn’t going to cancel.”

Diggs, who says he is the first openly gay deputy to serve at the Stafford county sheriff’s office, has worked as an officer for 8 years.

He uses his position within the force to give motivational speeches tackling a wide range of controversial subjects from race and abuse to people’s perception of law enforcement.

He hasn’t always had it easy. The officer was abandoned by his foster family when he came out.

“The first thing I did was tell my foster family, and after I told them they disowned me,” Diggs said.

“I told one person at the school, and I asked her not to tell anybody, and then it spread like wildfire. I spent roughly the next year in isolation. That was the worst year of my life, but also the best. I had to figure out how to love myself, and what I wanted to be.”

Despite the negative reaction by some, the dancing officer has now found himself and hopes to use his story to inspire others.

“The reason I’m doing this is to show kids that they can make it, that they can survive, that they can be successful,” he said.

“I’ve been very fortunate, at this time when people look negatively upon law enforcement, that I’m able to change that narrative and open up some conversations and engage with people.”

“That’s what this is about, loving one another and agreeing to disagree, but being respectful.”

Diggs and his partner Benjamin Leitnerm have been together for seven years and are due to get married in July next year.

“Meeting him was an act of God, it was out of this world,” Diggs said of his fiancé.