Negotiators were called out after a prisoner was spotted on the roof of Wrexham's HMP Berwyn.
The incident happened from about 3pm onwards on Tuesday.
In social media videos, the man could be seen removing his shirt and walking back and forth along the roof.
Person seen on roof at HMP Berwyn. Pictures courtesy of DJ Shaun Carr (Twitter / @shauncarr9)
Later in the afternoon images emerged of offices, who appeared to be in riot gear, approaching the man via a crane.
A Prison Service spokesman said: "Staff resolved an incident at height involving one prisoner at HMP Berwyn.
"The prisoner has been returned to custody.”
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules here