* Army chief says takeover needed to restore order
* Had urged rivals to agree compromise solution
* Military suspends constitution, announces night-time curfew
* Rival protest camps ordered to disperse
* Market analysts expect sell-off, say may not be severe (Updates with army summoning former PM Yingluck and 22 others)
By Amy Sawitta Lefevre
BANGKOK, May 22 (Reuters) - Thailand's army chief, General Prayuth Chan-ocha, seized control of the government in a coup on Thursday, two days after declaring martial law, saying the military had to restore order and push through reforms after six months of turmoil.
The military declared a 10 p.m. until 5 a.m. curfew, suspended the constitution and detained some politicians. It later summoned former prime minister Yingluck Shinawatra and 22 others, including relatives and ministers in her ousted government.
Rival protest camps were ordered to disperse and media censored. There were no reports of violence.
U.S. Secretary of State John Kerry said there was no justification for a coup, which would have "negative implications" for ties. The United States was reviewing its military and other assistance, "consistent with U.S. law".
Thailand is locked in a protracted power struggle between supporters of ousted former premier Thaksin Shinawatra and opponents backed by the royalist establishment that has polarised the country and battered its economy.
"In order for the situation to return to normal quickly and for society to love and be at peace again ... and to reform the political, economic and social structure, the military needs to take control of power," Prayuth said in a televised address.
The general made his broadcast after a meeting to which he had summoned the rival factions, with the aim of finding a compromise to defuse anti-government protests.
But no progress was made and Prayuth wound up the gathering by announcing he was seizing power, according to a participant.
The Thai armed forces have a long history of intervening in politics - there have been 18 previous successful or attempted coups since Thailand became a constitutional monarchy in 1932, most recently when Thaksin was deposed in 2006.
Hundreds of soldiers surrounded the meeting at Bangkok's Army Club shortly before the coup announcement and troops took away Suthep Thaugsuban, leader of the anti-government protests.
Some political party leaders were also detained, witnesses said.
Prayuth, who has for months been trying to keep the army out of the political confrontation, assumed the powers of the prime minister.
Soldiers fired shots into the air to disperse thousands of pro-government "red shirt" activists gathered in Bangkok's western outskirts.
The military detained one of the leading activists, a spokesman for the group said, and the protesters later left peacefully, many of them in vehicles provided by the military.
The army also ordered television and radio stations to halt programmes and broadcast its material, and banned gatherings of more than five people. It said it would block websites that spread false information or incited unrest.
The army had declared martial law on Tuesday, saying it was necessary to prevent violence. Twenty-eight people have been killed and 700 injured since the anti-government protests erupted late last year.
"Martial law may have been to test the waters; the army gave the opposing camps a chance to negotiate a way out, but I think the endgame was always the military taking over," said Kan Yuanyong of the Siam Intelligence Unit think-tank.
"The possibility of conflict is now much higher," he said. "Thaksin will fight back."
Former telecommunications tycoon Thaksin has lived in self-imposed exile since 2008 to avoid a jail term for graft, but commands the loyalty of legions of poor voters and exerts a huge influence over politics, most recently through his sister's government.
He was not available for comment but a pro-Thaksin activist in his hometown of Chiang Mai said there was no immediate plan to protest.
"As of now we will not head to Bangkok, no plans. We will follow today's situation closely first," said Mahawon Kawang.
Kerry said he was disappointed and concerned by reports that political leaders had been detained, and called for their release.
"This act will have negative implications for the U.S.-Thai relationship, especially for our relationship with the Thai military," he said in a statement.
The Pentagon said it was reviewing its military assistance and engagements, including an ongoing exercise involving about 700 U.S. Marines and sailors.
Under U.S. law, no foreign aid may flow to a country whose duly elected head of government is deposed in a coup, but the language of the law gives the Obama administration some latitude in how to interpret it.
There was condemnation from France, the European Union and the United Nations human rights office. Japan said the coup was regrettable and Australian Foreign Minister Julie Bishop said she was "gravely concerned".
Bangkok's streets were largely empty at curfew time. Some tourists, unaware of the coup, wondered why the bars were closing early.
In a first round of talks on Wednesday, Prayuth had called on the two sides to agree a compromise based on the appointment of an interim prime minister, political reforms, and an election. But both sides stuck to their entrenched positions.
On Thursday, after announcing his coup to the two sides' representatives, he told them, "Everyone must sit still," according to one participant who declined to be identified.
Leaders of the ruling Puea Thai Party and the opposition Democrat Party, the Senate leader and the five-member Election Commission were in the talks.
Yingluck was forced to step down as premier by a court two weeks ago, but her caretaker government limped on.
Thailand's economy shrank by 2.1 percent in January-March from the previous three months, largely because of the unrest, adding to fears that it is stumbling into recession.
But weary investors have generally taken Thailand's political upheavals in their stride, and analysts said the impact on markets in Southeast Asia's second largest economy might not be too severe.
The anti-government protesters want to rid Thailand the influence of Thaksin, who they say is a corrupt crony capitalist who commandeered a fragile democracy and used taxpayers' money to buy votes with populist giveaways.
They had wanted a "neutral" interim prime minister to oversee electoral reforms before a new vote.
The government said a general election was the best way forward. Thaksin or his parties have won every election since 2001. (Additional reporting by Juarawee Kittisilpa, Martin Petty and Bangkok bureau; Writing by Robert Birsel; Editing by Alan Raybould, Alex Richardson, Mike Collett-White and Kevin Liffey)