However, Foreign Secretary Vijay Gokhale said that Modi's visit to Nepal was decided soon after K P Sharma Oli's election as the prime minister in February.
The Congress on Saturday accused Prime Minister Narendra Modi of trying to “influence” voters in Karnataka on the polling day through his temple visits in Nepal.
Modi on Saturday prayed at Nepal's iconic Muktinath temple that is regarded sacred by both Hindus and Buddhists, becoming the first world leader to offer prayers there.
He also offered prayers at the Pashupatinath temple, located on the banks of the Bagmati river. The Pashupatinath temple is regarded as the most sacred and oldest temple of Shiva (Pashupati) in Nepal.
Polling is underway in 222 out of 224 seats in Karnataka which is witnessing a three-cornered contest.
Senior Congress leader Ashok Gehlot alleged that the prime minister had timed his visit to the Himalayan nation on the Karnataka poll date, and was "giving a message to Hindus" in the southern state.
Alleging violation of the model code of conduct, he said Modi's temple visits in Nepal were being aired on the day of polling in Karnataka.
“This is not a good tradition in a democracy. In Gujarat also, he held a road show after voting. Today, he has adopted a new path. When Karnataka is polling today, he has gone to Nepal and is worshipping in temples there, as he could not do so in the southern state due to elections," Gehlot said.
The AICC general secretary said Modi, through his temple visits, was giving out a message to voters in Karnataka of how religious he was and that he was a Hindu.
"If one asks him (Modi), no other person is Hindu, except the BJP and RSS people, besides him and Amit Shah," he said.
On the Nepal visit being planned earlier, the former Rajasthan chief minister reiterated that the prime minister had timed his Nepal visit to coincide with the Karnataka polls.
However, Foreign Secretary Vijay Gokhale said that Prime Minister Narendra Modi's visit to Nepal was decided soon after K P Sharma Oli's election as the prime minister.
Responding to a question at a press meet, Gokhale said Prime Minister Modi had telephoned Prime Minister Oli, who was sworn to the post on February 15, to congratulate him and the visits were discussed then.
"When Prime Minister Modi had telephoned Prime Minister Oli upon his election as the prime minister of Nepal, they had discussed the visit then. Prime Minister Oli had then expressed his desire for an early visit by Prime Minister Modi. They had discussed the visits, and the Prime Minister (Modi) had said you (Oli) come first.
"So that's how the sequence has been, first Prime Minister Oli visited India and now Prime Minister (Modi) is in Nepal," Gokhale said.
Oli had visited India in April.
On questions over the timing of the visit which coincides with the high-stake Karnataka assembly election, he said, "whenever state visits take place they are decided as per the convenience of the two nations. No one prime minister alone can say that I will come at this time."
"So, don't focus on the dates, but focus on the content of this visit," the foreign secretary said.
Modi arrived in Kathmandu yesterday on a two-day visit and held discussions with Oli on strengthening ties between the two neighbouring countries.
During the visit, the prime minister also offered prayers at the famed 20th century Janaki temple, the Mukhtinath and Pashupatinath temples and attended a civic reception at Janakpur.