About a year ago I was flying from DFW to JFK. I had an electrical malfunction that affected just about every system on the airplane.
My filed alternate (from dispatch) was Allentown, PA.
My company also had operations at Baltimore.
Our facility at JFK and Allentown has very limited ramp space and very limited maintenance capability in the case of Allentown, it has shorter runways.
Baltimore had a huge ramp, superior maintenance capability, long runways and hot spare aircraft and crews available and I could see Baltimore out of my left window.
I elected to divert to Baltimore. It was not my destination or my filed alternate, but was the wisest choice. That is where I landed.
I made that decision as PIC.
When we landed, cargo was switched from my busted bird to the hot spare aircraft and I flew the cargo to JFK in the hot spare airplane.
When I got to JFK the mechanics were praising me for not bringing the busted bird there. They had no place to put the airplane and did not have the resources to fix the airplane there.