I know there are two relative clauses in the above sentence, as shown below. Example structure is [verb/sentence]noun/main clause]
Relative clause 1: [身の危険が迫った]時]
Relative clause 2: [発現する]能力]
I know that clauses are made with the "sentence/verb + noun" construct, and the main clause extends to the end of the sentence unless in the case a second/third/etc relative clause exists, at which point the main clause will end where the next relative clause begins.
In the above case however, the particle に already exists in the first main clause, which makes me highly doubt the だけ particle is being used with the first clause (despite me knowing that particles can be combined in different ways; and this might be a case of seeing a combination I've not encountered before). This dictionary has a example of にだけ, and this answer gives a possible meaning which failed to answer my question.
Which clause is the だけ particle attached to, the first one (thereby making the first main clause 時にだけ), or the second one (thereby making the second relative clause だけ発現する)?
My best guess for the entire sentence would be that the だけ is attached to the 身の危険が迫った時に(だけ) clause, but I would still like to have a secondary opinion.