Secretary of State John Kerry on Friday pledged US support for Moroccan reforms and efforts to promote regional stability, while also highlighting the social challenges faced by Rabat.
"Morocco is playing an important leadership role, and the United States will stand by this relationship every step of the way," he said at the end of a North African tour.
"The 18 different agreements that Morocco signed with Mali show that Morocco is driving greater security and greater prosperity in the region," he added, speaking in Rabat alongside his Moroccan counterpart, Salaheddine Mezouar.
Those accords, signed in February during a tour of West Africa by King Mohammed VI, included an agreement to train hundreds of imams in Morocco.
Rabat is considered an important US ally in combatting radical Islamist ideology, which has enjoyed a revival elsewhere in North Africa since the 2011 Arab Spring uprisings that swept away decades-old dictatorships.
Morocco's agreement to train imams from nearby countries afflicted by jihadist violence, such as Mali, Tunisia and Libya, forms part of its strategy of promoting a more tolerant version of Islam.
The top US diplomat met Moroccan Prime Minister Abdelilah Benkirane after flying to Rabat from Algiers on Thursday evening.
Following his talks with Mezouar on Friday, he met King Mohammed VI in Casablanca before leaving for Washington.
Kerry cited joint military exercises conducted by Morocco's armed forces and US Africa Command (AFRICOM) -- which 18 nations took part in and which concluded on Friday in the southern city of Agadir -- as an aspect of the two countries' strategic cooperation.
Despite their ties, Rabat cancelled the annual military exercises, known as African Lion, during a diplomatic spat last year caused by Washington's surprise proposal to task the UN peacekeeping force in the disputed Western Sahara with human rights monitoring.
Morocco controls most of the former Spanish colony which it considers an integral part of its territory, but has increasingly come under fire over its human rights record there, including by influential US activists.
Rabat fiercely resisted Washington's move, lobbying aggressively to have the peacekeeping proposal dropped by the Security Council, which eventually happened.
In his talks with Mezouar, Kerry welcomed "recent actions and initiatives taken by Morocco" to promote human rights in the territory, noting the growing role of the official National Human Rights Council, according to a joint statement.
- 'Enormous challenges' -
Following last year's rift, King Mohammed VI flew to Washington in November to meet US President Barack Obama, who praised him for deepening democracy, and promoting economic progress and human development.
Obama also welcomed the king's commitment to abolishing the military trial of civilians, which the Moroccan government finally agreed to do in a bill approved last month.
Kerry said the United States was "deeply committed" to supporting the "major reforms" already undertaken by the king, and symbolised by the new constitution he introduced in 2011 in response to nationwide protests.
But he warned of the "enormous" social challenges facing Morocco and other countries across the region.
He cited the 2011 uprisings in Tunisia and Egypt as examples of the dangers facing governments that fail to provide opportunities for their burgeoning youth population.
"Sixty percent of the country is under 30 years old," Kerry said.
"The challenge of any government under those circumstances is to be able to provide jobs and opportunities for its young people. And that challenge is enormous."
Morocco's unemployment rate is officially pegged at around 10 percent.
But youth unemployment is as high as 30 percent according to the World Bank, and jobless graduates protest regularly in the capital, while companies based in Morocco complain about the shortage of skilled workers.