AB de Villiers has signed to play for Middlesex in the T20 Blast, the club announced on Monday.
The former South African skipper is available to play in the first seven rounds and, if necessary, will return for the latter stages of the tournament.
De Villiers is currently playing Pakistan Super League with Lahore Qalandars, where he is leading the side in the absence of injured Mohammad Hafeez.
He retired from international cricket early last year and has since featured in franchise T20 competitions only.
"I have always wanted to play county cricket, and I am very much looking forward to joining Middlesex," he said. "Playing at Lord's is always a wonderful privilege."
Law said: "It's exciting for all here at Middlesex to announce the arrival of AB de Villiers for the T20 Blast this season.
"It's a great opportunity for some of our younger players to pick the brain of one of the best players to have graced the game of cricket and for the support staff to work with him as well."