NOT much noticed by outsiders, long-troubled ties between two neighbours sharing a long border have taken a substantial lurch for the better. Ever since 2008, when the Awami League, helped by bags of Indian cash and advice, triumphed in general elections in Bangladesh, relations with India have blossomed. To Indian delight, Bangladesh has cracked down on extremists with ties to Pakistan or India's home-grown terrorist group, the Indian Mujahideen, as well as on vociferous Islamist (and anti-Indian) politicians in the country. India feels that bit safer.

Now the dynasts who rule each country are cementing political ties. On July 25th Sonia Gandhi (pictured, above) swept into Dhaka, the capital, for the first time. Sharing a sofa with Sheikh Hasina (left), the prime minister (and old family friend), the head of India's ruling Congress Party heaped praise on her host, notably for helping the poor. A beaming Sheikh Hasina reciprocated with a golden gong, a post-humous award for Mrs Gandhi's mother-in-law, Indira Gandhi. In 1971 she sent India's army to help Bangladeshis, led by Sheikh Hasina's father, Sheikh Mujibur Rahman, throw off brutal Pakistani rule.

As a result, officials this week chirped that relations are now “very excellent”. They should get better yet. India's prime minister, Manmohan Singh, will visit early in September to sign deals on sensitive matters like sharing rivers, sending electricity over the border, settling disputed patches of territory on the 4,095km (2,500-mile) frontier and stopping India's trigger-happy border guards from murdering migrants and cow-smugglers. Mr Singh may also deal with the topic of trade which, smuggling aside, heavily favours India, to Bangladeshi ire.

Most important, however, is a deal on setting up a handful of transit routes across Bangladesh, to reach India's remote, isolated north-eastern states. These are the “seven sisters” wedged up against the border with China.

On the face of it, the $10 billion project will develop poor areas cut off from India's booming economy. The Asian Development Bank and others see Bangladeshi gains too, from better roads, ports, railways and much-needed trade. In Dhaka, the capital, the central-bank governor says broader integration with India could lift economic growth by a couple of percentage points, from nearly 7% already.

Our interactive map displays the various territorial claims of India, Pakistan and China from each country's perspective

India has handed over half of a $1 billion soft loan for the project, and the money is being spent on new river-dredgers and rolling stock. Bangladesh's rulers are mustard-keen. The country missed out on an earlier infrastructure bonanza involving a plan to pipe gas from Myanmar to India. China got the pipeline instead.

Yet the new transit project may be about more than just development. Some in Dhaka, including military types, suspect it is intended to create an Indian security corridor. It could open a way for army supplies to cross low-lying Bangladesh rather than going via dreadful mountain roads vulnerable to guerrilla attack. As a result, India could more easily put down insurgents in Nagaland and Manipur. The military types fear it might provoke reprisals by such groups in Bangladesh.

More striking, India's army might try supplying its expanding divisions parked high on the border with China, in Arunachal Pradesh. China disputes India's right to Arunachal territory, calling it South Tibet. Some Bangladeshis fret that if India tries to overcome its own logistical problems by, in effect, using Bangladesh as a huge military marshalling yard, reprisals from China would follow.

Such fears are not yet widespread. Indeed, India has been doing some things right in countering longstanding anti-Indian suspicion and resentment among ordinary Bangladeshis. Recent polling by an American university among students found a minority hostile to India, whereas around half broadly welcomed its rise. A straw poll at a seminar of young researchers at a think-tank in Dhaka this week suggested a similar mood—though anger remained over Indian border shootings. For India, however, the risk is that it is betting too heavily on Sheikh Hasina, who is becoming increasingly autocratic. Opposition boycotts of parliament and general strikes are run-of-the-mill. Corruption flourishes at levels astonishing even by South Asian standards. A June decision to rewrite the constitution looks to be a blunt power grab, letting the government run the next general election by scrapping a “caretaker” arrangement. Sheikh Hasina is building a personality cult around her murdered father, “the greatest Bengali of the millennium”, says the propaganda. Elsewhere, the hounding of Muhammad Yunus, a Nobel laureate and founder of the Grameen Bank who briefly flirted with politics, was vindictive. Similarly, war-crimes trials over the events of 1971 are to start in a few weeks. They are being used less as a path to justice than to crush an opposition Islamic party, Jamaat-e-Islami. It hardly suggests that India's ally has a wholly secure grasp on power. A tendency to vote incumbents out may yet unseat Sheikh Hasina in 2013, or street violence might achieve the same. She would then be replaced by her nemesis, Khaleda Zia, of the opposition Bangladesh Nationalist Party. Mrs Zia's family dynasty, also corrupt, is as against India as Sheikh Hasina's is for it. But India's habit of shunning meetings with Mrs Zia and her followers may come to look short-sighted. When he visits Bangladesh in September, Mr Singh, the Gandhi family retainer, would do well to make wider contact if India's newly improving relations are not one day to take another big dive for the worse.

The Economist has received a letter from the government of Bangladesh in response to this article. You can read the letter here.