Supreme Court judges ruled on Friday that they did not find any reason for the detentions and ordered the government to free them immediately.
Among them, 13 were brought to the court while the rest were expected to be freed from several detention centres in the capital, Katmandu.
Hundreds of politicians and activists have been jailed by the government in the past few weeks during crackdown on protest rallies and police raids on homes and party offices.
But dozens of politicians, human rights activists, student leaders and pro-democracy activists have been freed in the past few days following a series of lawsuits filed by rights groups demanding the government produce charges against the men.
The courts ordered them to be released after the government failed to comply.
Hundreds of people have been jailed since Nepal's King Gyanendra seized power a year ago and declared a state of emergency. The prisoners have been jailed for varying lengths of time - anywhere from a few days to many months.
The latest developments come ahead of a protest rally scheduled for Sunday to mark Democracy Day, which celebrates a popular movement that forced the previous king to establish a multi-party democracy.