The longest solar eclipse of the 21st century pitched a swath of Asia from India to China into near darkness Wednesday as millions gathered to watch the phenomenon.

But millions more, gripped by fear, shuttered themselves in. India abounds in superstitions and fables based on Hindu mythology, one of which says an eclipse is caused when a dragon-demon swallows the sun.

The eclipse is caused when the moon covers the sun completely to cast a shadow on earth. In some parts of Asia it lasted as long as 6 minutes and 39 seconds.

• Click here for more photos.

• Click here to read how the eclipse is frightening some Indians.

Thick cloud cover over India obscured the sun when the eclipse began at dawn. But the clouds parted in several cities, minutes before the total eclipse took place at 6.24 a.m. (0054 GMT; 8:54 p.m. EDT).

In neighboring Bangladesh, people came out in droves.

"It's a rare moment, I never thought I would see this in my life," said Abdullah Sayeed, a college student who traveled to Panchagarh town from the capital Dhaka to view it.

He said cars in the town needed to use headlights as "night darkness has fallen suddenly." People hugged each other and some blew whistles when the eclipse began, he said.

One of the best views, shown live on several television channels, appeared to be in the Indian town of Varanasi, on the banks of the Ganges river, sacred to devout Hindus.

Thousands of Hindus took a dip in keeping with the ancient belief that bathing in the river at Varanasi, especially on special occasions, cleanses one's sins. The eclipse was seen there for 3 minutes and 48 seconds.

The eclipse — visible only in Asia — was moving north and east from India to Nepal, Myanmar, Bangladesh, Bhutan and China.

It is the longest such eclipse since July 11, 1991, when a total eclipse lasting 6 minutes, 53 seconds was visible from Hawaii to South America. There will not be a longer eclipse than Wednesday's until 2132.

"We'll have to wait a few hundred years for another opportunity to observe a solar eclipse that lasts this long, so it's a very special opportunity," said Shao Zhenyi, an astronomer at the Shanghai Astronomical Observatory.

A 10-member team of scientists from the premier Indian Institute of Astrophysics in Bangalore and the Indian air force were to fly and film the eclipse, an air force press release said.

Scientists said the Indian village of Taregna would have the clearest view, where thousands of scientists, nature enthusiasts and students gathered a day in advance.

But their party was spoiled by thick clouds and overnight rains, although the town was still thrown into a cloudy darkness.

"It was still a unique experience with morning turning into night for more than three minutes," said Amitabh Pande, a scientist with India's Science Popularization Association of Communicators and Educators, after watching the eclipse.

The clouds and rain were welcomed by many in this agricultural area which has seen scant rainfall this monsoon season.

"It would have been nice to see the solar eclipse but the rain is far more important for us," said Ram Naresh Yadav, a farmer.

Millions across India were shunning the sight and planned to stay indoors.

Even in regions where the eclipse was not visible, pregnant women were advised to stay indoors in curtained rooms over a belief that the sun's invisible rays would harm the fetus and the baby would be born with disfigurations, birthmarks or a congenital defect.

Krati Jain, a software professional in New Delhi, said she planned to take a day off from work Wednesday to avoid what she called "any ill effects of the eclipse on my baby."

"My mother and aunts have called and told me stay in a darkened room with the curtains closed, lie in bed and chant prayers," said Jain, 24, who is expecting her first child.

In the northern Indian state of Punjab, authorities ordered schools to begin an hour late to prevent children from venturing out and gazing at the sun.

Others saw a business opportunity: one travel agency in India scheduled a charter flight to watch the eclipse by air, with seats facing the sun selling at a premium.

• Click here to visit FOXNews.com's Natural Science Center.