The performance of a dual-hop amplify-andforward relaying system in the presence of a jammer is analyzed by obtaining the end-to-end outage probability for the scenario where the system is interference-limited and operates in either Nakagami-0.5 or Rayleigh fading environments. Then, the optimal power allocation and transmission towards the relay and destination for maximizing the outage probability is analyzed. It is shown that for both fading environments when the jammer power is sufficiently large, jamming the relay and destination with equal power allocation is optimal, while when the jamming power is low, more power should be allocated to jam any of the source-relay and relay-destination links having lower receiving signal power. In addition, the difference between the optimal and the equal power allocation performance is investigated. Analytical results are verified and illustrated by some numerical results and simulations.