How can I make the light bar, after compositing (applying the blur effect on it), be displayed behind the ball, not in front of it?

How can I make the light bar, after compositing (applying the blur effect on it), be displayed behind the ball, not in front of it?

Expanding on Gunslinger's answer, this can be done on two render layers, using an ID Mask node:
With the foreground object selected, set the Pass index to 1 in Object properties > Relations:

Enable the Object index pass in Render Layers > Passes:

Add an ID Mask node and set the Index to 1.
Plug the IndexOB output from the Renderlayer node into the ID Mask node. This will provide a mask for the foreground object:

Mix:
Gunslinger's setup is better as it preserves the sky:
Note that you can also use ID masks on a material basis.
Enable Material index in Render layers > Passes, and set the pass index for the material:
Use Materials > Settings > Pass index to set the pass index of the material in Cycles:

Or in Blender internal use Materials > Options > Pass index:

If, you are rendering with Blender Internal, one way to go about this is to go to the render layers with the ball and the bar and under Layer, untick Sky for both. Since this will remove the background from both those layers, just create another RenderLayer that will just be the sky.

Now if you use an Alpha Over node, you can choose which object appears over which one by switching the inputs. You will then use another Alpha Over node to get back the background.

For Cycles, you can get the same results by making sure that Use Environment is ticked under Layer and then ticking Transparent under Film, this will affect all render layers however it seems so perhaps you can use an image as the second input for the second Alhpa Over node, just render out a nice gradient etc and load it back in as an image.
Another way to do this would be to render another pass with only the ball, call it mask. Override the material to be pure black.
Multiply the line with this renderpass. Before or after the blur node if you want the glow to overlap the ball slightly, or not.
Note! (if I have time tonite, I will update the screenshot). The background of the mask must of course be white, else it will dim the line.
Node setup here: