Gillingham have announced that they have signed Max Ehmer on a three-year deal from Queens Park Rangers.
The defender, who makes the switch on a free transfer, spent time on loan with the League One side last season, scoring once during 29 appearances.
Manager Justin Edinburgh told the club's website: "This is a great signing for us, I've made no secret of the fact that I had wanted Max to return if the opportunity came up and we have now reached an agreement.
"Max was an excellent performer during his time at the club last season and he will only get better over time. I'm delighted he is back with us and look forward to working with him once again."
Ehmer added: "I'm really pleased to be back, I enjoyed my time here last season and played a lot of games. I am now looking forward to the start of the season and will be working hard to ensure I am 100% fit."
Ehmer made just one league appearance for QPR in his five years with the senior squad.