* Attorney general says U.S. should consider buying stakes
* Move would be to counter Huawei 5G dominance
* Ericsson shareholder urges co to explore interest
* Ericsson, Nokia shares rise more than 4% (Adds detail, background, updates shares)
STOCKHOLM, Feb 7 (Reuters) - Shares in Ericsson and Nokia rose on Friday after a U.S. official suggested the United States should consider buying stakes in the telecom equipment makers to counter China-based Huawei's dominance in 5G technology.
U.S. Attorney General William Barr said in a speech on Thursday that the United States and its allies should consider the highly unusual step of taking a "controlling stake" in one or both of the Nordic rivals to Huawei.
5G networks are at the centre of a dispute over technology between the United States and China as they are expected to host a range of critical functions from driverless vehicles to smart electric grids and military communications, underscoring their importance to national security.
The United States has blacklisted Huawei and is in the midst of a worldwide campaign to convince allies to ban the Chinese giant from their 5G networks, alleging its equipment could be used by Beijing for spying - which Huawei denies.
Barr's comments helped lift shares in the Nordic companies, with both gaining more than 4% by 1031 GMT.
U.S. government investments in public companies are rare except in bailouts to save ailing firms and jobs, and even more so concerning foreign companies.
While the two companies, which together with Huawei dominate the market, declined to comment on Barr's remarks, Ericsson shareholder, activist fund Cevian Capital, said it welcomed the apparent U.S. interest and urged executives at the Swedish company in which it holds an 8.4% stake to explore the potential opportunity.
"A U.S. interest in Ericsson is clearly positive for Sweden, the company and the shareholders," Cevian Capital managing partner Christer Gardell told Reuters in emailed comments.
"A potential deal would have to be based on a completely different valuation level than today's ridiculous share price for Ericsson," Gardell added. "The board and management need to drive and handle this question with the highest priority."
Investment firm Investor AB, the biggest owner by voting rights in Ericsson, declined to comment, as did the second-biggest owner by votes, Industrivarden.
Barr said in his speech at a conference on Chinese economic espionage that a move to secure a controlling interest in Huawei's main rivals could take place "either directly or through a consortium of private American and allied companies".
Over the past decade, speculation has circulated among investors and media concerning potential interest from U.S. technology giant Cisco's in a tie-up with Ericsson, although a concrete offer has never materialised.
President Donald Trump signed an executive order last year barring U.S. companies from using telecommunications equipment made by companies posing a national security risk and he has pressed nations not to grant Huawei access to 5G networks.
Britain in late January still granted Huawei a limited role in the country's 5G mobile network, and the EU followed its example by allowing members to decide what part Huawei can play in its 5G networks. (Reporting by Johannes Hellstrom; additional reporting by Anna Ringstrom in Stockholm and Mark Hosenball and David Brunnstrom in Washington DC; writing by Niklas Pollard; editing by David Evans and Louise Heavens)