And the Saint walked in Sunset

On 3 June 1947, Viscount Louis Mountbatten, the last British Governor-General of India, announced the partitioning of British India into India and Pakistan. With the speedy passage through the British Parliament of the Indian Independence Act 1947, at 11:57 on 14 August 1947 Pakistan was declared a separate nation, and at 12:02, just after midnight, on 15 August 1947, India also became an independent nation.

Gandhiji on Independence
Gandhiji was against partition at any cost but he was unable to convince the Congress leaders of the wisdom of his stand.
Gandhi declined to attend the celebrations in the capital and went to Calcutta where communal riots were still raging. And then on the day of independence a miracle happened. A year-old riot stopped as if by magic and Hindus and Muslims began to fraternize with one another. Gandhi spent a day in fast and prayer.
Unfortunately, the communal frenzy broke loose again on August 31, and while he was staying in a Muslim house, the safety of his own persons was threatened. On the following day he went on a fast which was “to end only if and when sanity returns to Calcutta”. The effect was magical. Those who had indulged in loot, arson and murder amid shouts of glee, came and knelt by his beside and begged for forgiveness. On September 4, the leaders of all communities in the city brought him a signed pledge that Calcutta would see no more of such outrages. Then Gandhi broke the fast. Calcutta kept the pledge even when many other cities were plunged in violence in the wake of Partition.
Gandhiji’s Quest for Peace
January 13, 1948. Gandhi Ji started the fast again. On January 18, after a week of painful suspense and anxiety, representatives of various communities and organizations in Delhi including the militant Hindu organization known as R.S.S., came to Birla house where Gandhi lay on a cot, weak but cheerful, and gave him a written pledge that “we shall protect the life, property and faith of the Muslims and that the incidents which have taken place in Delhi will not happen again”. Gandhi then broke the fast amid the chanting of passages from the various scriptures of the world.
Though the fast had touched the hearts of millions all over the world, its effect on the Hindu extremists was different. They were incensed at the success of the fast and felt that Gandhi had blackmailed the Hindu conscience to appease Pakistan.
On the second day after the fast while Gandhi was at his usual evening prayers, a bomb was thrown at him. Fortunately it missed the mark. Gandhi sat unmoved and continued his discourse.
हे राम
On January 30, 1948, ten days after the bomb incident, Gandhi hurriedly went up the few steps of the prayer ground in the large park of the Birla House. He had been detained by a conference with the Deputy Prime Minister, Sardar Vallabhbhai Patel, and was late by a few minutes. He loved punctuality and was worried that he had kept the congregation waiting. “I am late by ten minutes,” he murmured. “I should be here at the stroke of five.” He raised his hands and touched the palms together to greet the crowd that was waiting. Every one returned the greeting. Many came forward wanting to touch his feet. They were not allowed to do so, as Gandhi was already late. But a young Hindu from Poona forced his way forward and while seeming to do obeisance fired three point-blank shots from a small automatic pistol aimed at the heart. Gandhi fell, his lips uttering the name of God (He Ram). Before medical aid could arrive the heart had ceased to beat-the heart that had beat only love of man. 
Thus died the Mahatma, at the hands of one of his own people, to the eternal glory of what he had lived for and to the eternal shame of those who failed to understand that he was the best representative of the religion for which he suffered martyrdom.
Gandhi-Irwin Pact and Bhagat Singh
For those who think that Gandhi was behind the death sentence of Bhagat Singh here is the full story behind it,
Yes Gandhi ji was againt any act of violence and Un lawful activities though he was a great admirer of Bhagat Singh and all the revolutionaries but was worried for the result of it. 
Gandhi also once remarked about capital punishment, “I cannot in all conscience agree to anyone being sent to the gallows. God alone can take life, because he alone gives it.
Gandhi had managed to have 90,000 political prisoners who were not members of his Satyagraha movement released under the Gandhi-Irwin Pact. According to a report in the Indian magazine Frontline, he did plead several times for the commutation of the death sentence of Singh, Rajguru and Sukhdev, including a personal visit on 19 March 1931. In a letter to the Viceroy on the day of their execution, he pleaded fervently for commutation, not knowing that the letter would be too late.
Lord Irwin, the Viceroy, later said:
As I listened to Mr. Gandhi putting the case for commutation before me, I reflected first on what significance it surely was that the apostle of non-violence should so earnestly be pleading the cause of the devotees of a creed so fundamentally opposed to his own, but I should regard it as wholly wrong to allow my judgment to be influenced by purely political considerations. I could not imagine a case in which under the law, penalty had been more directly deserved.