TRUMP RALLY GUNMANSeen Opening Fire …AND GETTING KILLED SECONDS LATER

The Trump rally gunman was laid out on his belly, took aim and fired shots into the crowd before he got met with incoming bullets that killed him … and TMZ has it all on video.

We’ve obtained an incredible clip that shows the moment the gunman opened fire at the Butler, PA rally Saturday — and you can see the guy looking through either a scope or iron sights on a roof … with people watching down below and freaking out, their panic palpable.

The guy has longer brown hair, and he seems to be wearing a grey shirt/khaki pants — and as you can see, he’s carefully trying pinpoint a target from afar before pulling the trigger.

Once bullets start to ring out, you can hear people screaming on the ground and a mass scramble take place …. and only moments later, you can hear incoming gunfire — with multiple pops coming his way, and at that point … the gunman was struck, all on camera.

The cameraman, Michael Difrischia, panned back to the gunman after the retaliating rounds could be heard … and sure enough, you see the gunman laying there limp and lifeless. You can hear someone off-camera say, “That’s exactly why we need f***ing Trump here.”

In terms of what led up to this … Difrischia tells us he and his wife, Amber, were watching the Trump rally from outside the main grounds … standing near some trees with about 30 to 40 other people, when Amber noticed the dude climbing up onto a nearby building there.

We’re told he shimmied up, then army crawled to his final position on the roof — all with a rifle in hand, mind you — and then he lined up his shot, despite people clearly noticing him down below and attempting to flag cops or whoever else would listen, we’re told.

Eventually he fired, and like we said … he was met with almost instantaneous gunfire in return … killing him. Others on the ground caught the aftermath, showing his dead body.

Still no word on the name/identity of this individual, let alone his motive … but this case is now being investigated as an attempted assassination — which Trump miraculously survived.

After Trump’s ear got nicked, Secret Service pounced on him and eventually whisked him away — at which point he was defiant and pumped his fist in the air, with blood dripping.

Trump was taken to a hospital and treated … and he’s in stable condition. He issued a statement afterward, thanking law enforcement and condemning the attempt on his life.

In terms of the account given to us about the gunman … it jibes with what another eyewitness said to the BBC — people saw this guy and were trying to sound the alarm, but for some reason, he was able to get shots off on the ex-Prez before finally being taken out.

Scary stuff, indeed.