Years ago I had the same exact experience - right down to the You’re lucky I didn’t [expletive] shoot you,” from the pigs.
I heard something late at night and saw shadows moving in my back yard. I grabbed a gun and went to investigate. When I got to the corner of my house I saw several forms moving in the shadows and retreated towards my door. They must have seen me at the same time because they immediately followed. I retreated inside and barred the door.
The faceless (and largely featureless) shapes came up on the porch and pounded on the door and wall demanding entrance. I had all the lights out inside (it was 01:00) and turned on the porch light which revealed that they were cops. Or at least wearing uniforms. I shouted through the door for them to get off my property. They insisted that I come out. The one cop shouted that either I come out or they would break down the door. I replied that there were children in the house and that I was armed. I repeated my insistence that they leave and they repeated that I surrender.
Finally I suggested that they call in a sergeant or someone with at least a little common sense. Amazingly they did. When he showed up I explained the situation to him (through the still closed door of course) my situation and my desire to be left alone. Even more amazingly he agreed that this was something blown out of proportion and told his crew to stand down.
He said that there was a report of prowlers and that one of his guys “thought he saw” someone going up my driveway. He did scold me for not being more cooperative and I responded, “Consider it from my perspective”. He nodded (which was all the consideration I was going to get).
I moved out of Seattle shortly after that.