A man fatally shot his father before taking his own life in an Upper East Side hi-rise Wednesday afternoon, police said.

The shooter — identified by sources as Joseph O’Neill Jr. — gunned down his 61-year-old father inside a 30th floor unit in the Ruppert House Apartments on East 93rd Street near Third Avenue around 1:40 p.m., Chief of Detectives Robert Boyce said at an unrelated press conference.

O’Neill Jr., 37, then fatally shot himself.

Joseph O’Neill Sr. was visiting his son and ex-wife — who live in separate units in the same building — when the murder-suicide unfolded, police sources said.

When O’Neill Sr. arrived, his ex-wife was out walking the dog.

Once she finished, she walked into her son’s apartment to say hello, and discovered the grim scene, according to sources.

She saw her ex-husband slumped over in his seat, and dashed out of the apartment for help, sources said.

When she came back, she noticed that her son was also sprawled out on the floor of the blood-soaked apartment.

Investigators recovered a gun registered to O’Neill Sr. inside the apartment, sources said.

The same sources said that both the father and son had histories of psychiatric issues.