A Staten Island priest hanged himself in an apparent suicide last night inside his church’s rectory, police said.

The priest, identified by the pastor of Our Lady Queen of Peace Church in New Dorp as the Rev. James Pilsner, 35, had been missing since 3 p.m., law-enforcement sources said.

Another priest went to Pilsner’s room and noticed the door was locked.

He went to get a spare key and, when he opened the door, found Pilsner hanging from a rope attached to a chin-up bar, the sources said.

Pilsner was pronounced dead at the scene, police said.

“All I can tell you is Father James Pilsner died this evening in the rectory,” said the pastor, the Rev. John Sheehan.

But the sources said that it was a suicide and that Pilsner had been treated for depression.

After attending St. Joseph’s Seminary in Yonkers, Pilsner was ordained in 2001, according to Catholic New York’s Web site.

The Seaford, L.I., native came from a family of priests. Two older brothers preceded him by entering the clergy.

One brother, Father Peter Pilsner, taught religion at Cardinal Spellman HS in The Bronx. Another, Father Joseph Pilsner, was a priest in Toronto.

James Pilsner also had a third brother and a sister, who died in 1999.

Despite the religious family background, Pilsner wasn’t certain he wanted to be a priest while growing up, telling Catholic New York that he didn’t hear a calling until he made a trip to Poland in 1992.

“It hit me rather suddenly,” he told the paper in 2001. “I couldn’t run away from my vocation anymore, and knew I had to return to New York to see if God was calling me to the priesthood.”

Pilsner earned degrees in humanities and mathematics from Gannon University in Pennsylvania and served in a Dutchess County parish while studying at St. Joseph’s.

At the seminary, Pilsner was assigned to visit retired nuns at Mary the Queen Convent in Yonkers. He also taught religious education at St. Eugene’s parish, also in Yonkers.

At the time of his ordination, Pilsner said he wanted to be “a G.P. priest” – describing himself as a general practitioner.

“I think the most essential work of the priest is through the sacraments at the parish level – celebrating Mass, hearing confessions, ministering the other sacraments,” he said.