A man pulled over for a traffic stop, rolled his window down, drew a handgun and opened fire on cops before being fatally shot by a deputy, graphic video released Wednesday by a sheriff's department in Northern California shows.

The Napa County Sheriff's Office said in a Facebook post the incident happened around 11 p.m. on Sunday along a rural road near Napa.

"It's graphic, it's brutal, it's sudden," Napa County Undersheriff Jon Crawford said at a news conference.

OHIO MAN SUCKER-PUNCHES ATTORNEY AFTER HE’S SENTENCED TO 47 YEARS IN PRISON, OFFICIALS SAY

Napa County Sheriff's Deputy Riley Jarecki was on patrol when she came across 43-year-old Javier Hernandez Morales sitting in the parked car she deemed suspiciously parked. Jarecki then proceeded to walk over to the other side of the vehicle and ask Morales to roll down the window.

In the video, Morales compiles but then appears to fire at least one shot at Jarecki and misses. Jarecki radios for help, retreats to the car's passenger side and returns fire, unloading her weapon and killing Morales in a hail of bullets.

Officials said in addition to the handgun he fired at the officer, Morales had a loaded .22-caliber rifle in the car.

"We are extremely proud of her, she did a great job, her dad's very proud of her," Napa County Sheriff John Robertson told KTVU.

Jarecki was sworn in as a Napa County Deputy just six months ago, and her father is a sergeant with the department. Her grandfather also served with the Napa Police Department.

WORK-RELEASE INMATES RESCUE FLORIDA BABY LOCKED INSIDE SUV, DRAMATIC VIDEO SHOWS

"When you're in that situation, when you're in a gun battle, you want to win,' the sheriff told KTVU. "And she did beautifully, she did what she was trained to do."

Morales has a criminal history that includes arrests for DUI, assault on an officer and weapons violations, according to police.

Jarecki was not injured but has been placed on administrative leave.

CLICK HERE FOR THE FOX NEWS APP

The shooting remains under investigation by the Napa County Major Crimes Task Force.

The Associated Press contributed to this report.