MOSCOW — The United States ambassador to Russia announced on Tuesday that he would leave his post and return to the United States after the conclusion of the Winter Olympics that begin in Sochi on Friday.

Ambassador Michael A. McFaul, a former senior adviser to President Obama who spearheaded a “reset” in relations with Russia during the president’s first term, served during a stormy period in Moscow in which he was criticized by pro-government media for meeting with opposition politicians.

“After more than five years of work in the administration of President Obama, the time has come to return home,” he said in an online Russian-language blog that he has updated regularly.

In the blog, Mr. McFaul said that he planned to return to California to be with his wife and two sons, who left Russia at the end of the summer before the start of the new school year.

“After 7 months of separation, I simply need to be with my family. A 9,000 km commute just doesn’t work,” he said on Twitter.

Ben Rhodes, the director for strategic communications at the National Security Council, said in a statement that Mr. Obama was “deeply grateful” for Mr. McFaul’s service as an adviser and ambassador, highlighting the conclusion of a new strategic arms treaty signed by the two countries in 2010.

He also noted Mr. McFaul’s record on human rights issues, which has often been portrayed by Russian officials as interference in the country’s internal politics.

“Mike has been tireless in advocating for the universal values that America stands for around the world, reaching out to civil society, and recognizing the right of every voice to be heard,” Mr. Rhodes said.